# How to use highline

**URL:** <https://www.ruby-forum.com/t/how-to-use-highline/125680>\
**Category:** Ruby\
**Created:** [January 11, 2008, 4:01am UTC](https://www.ruby-forum.com/t/how-to-use-highline/125680 "2008-01-11T04:01:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 11, 2008, 4:01am UTC](https://www.ruby-forum.com/t/how-to-use-highline/125680/1 "2008-01-11T04:01:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 11, 2008, 6:43am UTC](https://www.ruby-forum.com/t/how-to-use-highline/125680/2 "2008-01-11T06:43:31Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 11, 2008, 3:03pm UTC](https://www.ruby-forum.com/t/how-to-use-highline/125680/3 "2008-01-11T15:03:02Z")

</div>

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

> 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](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](http://highline.rubyforge.org/svn/trunk/highline/examples/menus.rb)

James Edward G. II
