summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-10-08 00:10:29 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-10-09 23:33:48 -0300
commit8f8eb73bb873e4b91e04fd82d99935884dbb6f8f (patch)
tree81b717461ba1c68c77108fc566abe8312ded52ba /README.md
parent36d5ead9d29ec107a55bae8c5b254fe4c3ba54a4 (diff)
downloadhighline-8f8eb73bb873e4b91e04fd82d99935884dbb6f8f.tar.gz
Merge all example snippets on README.md
Diffstat (limited to 'README.md')
-rw-r--r--README.md26
1 files changed, 10 insertions, 16 deletions
diff --git a/README.md b/README.md
index 9db95c1..e8c953f 100644
--- a/README.md
+++ b/README.md
@@ -38,40 +38,34 @@ Examples
Basic usage:
-```ruby
ask("Company? ") { |q| q.default = "none" }
-```
-Validation:
-```ruby
+# Validation
+
ask("Age? ", Integer) { |q| q.in = 0..105 }
ask("Name? (last, first) ") { |q| q.validate = /\A\w+, ?\w+\Z/ }
-```
-Type conversion for answers:
-```ruby
+# Type conversion for answers:
+
ask("Birthday? ", Date)
ask("Interests? (comma sep list) ", lambda { |str| str.split(/,\s*/) })
-```
-Reading passwords:
-```ruby
+# Reading passwords:
+
ask("Enter your password: ") { |q| q.echo = false }
ask("Enter your password: ") { |q| q.echo = "x" }
-```
-ERb based output (with HighLine's ANSI color tools):
-```ruby
+# ERb based output (with HighLine's ANSI color tools):
+
say("This should be <%= color('bold', BOLD) %>!")
-```
-Menus:
-```ruby
+# Menus:
+
choose do |menu|
menu.prompt = "Please choose your favorite programming language? "
menu.choice(:ruby) { say("Good choice!") }