how to use highline

Discussion in 'Ruby' started by Junkone, Jan 11, 2008.

  1. Junkone

    Junkone Guest

    Hello
    I am trying highline and am little confused here.
    for eg
    menu.choice:)load, "Load a file.") do |command, details|
    say("Loading file with options: #{details}...")
    end


    what can go into command and details.
    menu.choice:)list, "List Services.") do |system("dir c:
    \temp"),details| but it does not like it. the examples that i ahve
    dont have any clear examples for what the command is and what the
    details are.

    appreciate some input.
    seede
    Junkone, Jan 11, 2008
    #1
    1. Advertising

  2. Junkone

    Dante Regis Guest

    [Note: parts of this message were removed to make it a legal post.]

    Hi there

    I believe you are actually trying to do this:
    menu.choice:)load, "Load a file") do |a, b|
    system("dir c:\temp")
    end
    menu.choice:)close, "Close a file") do |a, b|
    puts "hmm, let's close it"
    end

    You see, command and details, on the example, are variable names. You don't
    actually put what you want the menu to execute in there. It is a Ruby Block,
    maybe you would want to read something on
    http://whytheluckystiff.net/ruby/pickaxe/html/tut_containers.html (search
    for "Blocks for Transactions" on the page).

    I named the variables A and B so you can see that the name you give them
    don't matter (at least not to ruby, but surely matters to your mental sanity
    if you look to the code after a few months). Variable A will have :load or
    :close as it's value, depending on what you type on the menu when it's
    running.

    Hope this helps

    Dante

    On Jan 11, 2008 12:00 AM, Junkone <> wrote:

    > Hello
    > I am trying highline and am little confused here.
    > for eg
    > menu.choice:)load, "Load a file.") do |command, details|
    > say("Loading file with options: #{details}...")
    > end
    >
    >
    > what can go into command and details.
    > menu.choice:)list, "List Services.") do |system("dir c:
    > \temp"),details| but it does not like it. the examples that i ahve
    > dont have any clear examples for what the command is and what the
    > details are.
    >
    > appreciate some input.
    > seede
    >
    >
    Dante Regis, Jan 11, 2008
    #2
    1. Advertising

  3. Junkone

    James Gray Guest

    On Jan 10, 2008, at 11:42 PM, Dante Regis wrote:

    > Hi there
    >
    > I believe you are actually trying to do this:
    > menu.choice:)load, "Load a file") do |a, b|
    > system("dir c:\temp")
    > end
    > menu.choice:)close, "Close a file") do |a, b|
    > puts "hmm, let's close it"
    > end
    >
    > You see, command and details, on the example, are variable names.
    > You don't
    > actually put what you want the menu to execute in there. It is a
    > Ruby Block,
    > maybe you would want to read something on
    > http://whytheluckystiff.net/ruby/pickaxe/html/tut_containers.html
    > (search
    > for "Blocks for Transactions" on the page).


    You may also want to over HighLine's menu examples:

    http://highline.rubyforge.org/svn/trunk/highline/examples/menus.rb

    James Edward Gray II
    James Gray, Jan 11, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ruby Quiz

    [QUIZ] HighLine (#29)

    Ruby Quiz, Apr 22, 2005, in forum: Ruby
    Replies:
    8
    Views:
    141
    James Edward Gray II
    Apr 22, 2005
  2. Ryan Leavengood

    [SOLUTION] HighLine (#29)

    Ryan Leavengood, Apr 24, 2005, in forum: Ruby
    Replies:
    6
    Views:
    115
    James Edward Gray II
    Apr 29, 2005
  3. mark sparshatt

    [SOLUTION] Highline (#29)

    mark sparshatt, Apr 24, 2005, in forum: Ruby
    Replies:
    0
    Views:
    129
    mark sparshatt
    Apr 24, 2005
  4. Ruby Quiz

    [SUMMARY] HighLine (#29)

    Ruby Quiz, Apr 28, 2005, in forum: Ruby
    Replies:
    0
    Views:
    148
    Ruby Quiz
    Apr 28, 2005
  5. James Edward Gray II

    [ANN] HighLine 0.2.0

    James Edward Gray II, Apr 29, 2005, in forum: Ruby
    Replies:
    2
    Views:
    102
    James Edward Gray II
    Apr 29, 2005
Loading...

Share This Page