summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lib/highline/menu.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/README.md b/README.md
index 0b4b258..5588cbc 100644
--- a/README.md
+++ b/README.md
@@ -74,6 +74,7 @@ cli.choose do |menu|
menu.prompt = "Please choose your favorite programming language? "
menu.choice(:ruby) { cli.say("Good choice!") }
menu.choices(:python, :perl) { cli.say("Not from around here, are you?") }
+ menu.default = :ruby
end
## Using colored indices on Menus
diff --git a/lib/highline/menu.rb b/lib/highline/menu.rb
index 02d547a..e1834ef 100644
--- a/lib/highline/menu.rb
+++ b/lib/highline/menu.rb
@@ -540,7 +540,7 @@ class HighLine
end
def show_default_if_any
- return !@default.to_s.empty? ? "(#{@default}) " : ""
+ return default.to_s.empty? ? "" : "(#{default}) "
end
#