summaryrefslogtreecommitdiff
path: root/examples/menus.rb
diff options
context:
space:
mode:
Diffstat (limited to 'examples/menus.rb')
-rw-r--r--examples/menus.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/menus.rb b/examples/menus.rb
index 258c1ca..5941f17 100644
--- a/examples/menus.rb
+++ b/examples/menus.rb
@@ -7,7 +7,7 @@ puts "Using: #{HighLine.default_instance.terminal.class}"
puts
# The old way, using ask() and say()...
-choices = %w{ruby python perl}
+choices = %w[ruby python perl]
say("This is the old way using ask() and say()...")
say("Please choose your favorite programming language:")
say(choices.map { |c| " #{c}\n" }.join)
@@ -25,10 +25,9 @@ choose do |menu|
menu.prompt = "Please choose your favorite programming language? "
menu.choice :ruby do say("Good choice!") end
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
+ menu.choices(:python, :perl) { say("Not from around here, are you?") }
menu.default = :ruby
-
end
say("\nThis is letter indexing...")
@@ -39,7 +38,7 @@ choose do |menu|
menu.prompt = "Please choose your favorite programming language? "
menu.choice :ruby do say("Good choice!") end
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
+ menu.choices(:python, :perl) { say("Not from around here, are you?") }
end
say("\nThis is with a different layout...")
@@ -50,7 +49,7 @@ choose do |menu|
menu.prompt = "Favorite? "
menu.choice :ruby do say("Good choice!") end
- menu.choices(:python, :perl) do say("Not from around here, are you?") end
+ menu.choices(:python, :perl) { say("Not from around here, are you?") }
end
say("\nYou can even build shells...")
@@ -60,10 +59,10 @@ loop do
menu.shell = true
- menu.choice(:load, "Load a file.") do |command, details|
+ menu.choice(:load, "Load a file.") do |_command, details|
say("Loading file with options: #{details}...")
end
- menu.choice(:save, "Save a file.") do |command, details|
+ menu.choice(:save, "Save a file.") do |_command, details|
say("Saving file with options: #{details}...")
end
menu.choice(:quit, "Exit program.") { exit }