Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Explain that we can specify multiple options by using the method_opti…

…ons helper
  • Loading branch information...
commit 9a2068ab898c417750e6cd72ac151ea697d34f3b 1 parent 417fe26
Ryan Bigg authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 gem-development.md
9 gem-development.md
View
@@ -285,6 +285,15 @@ When we run our scenarios again with `bundle exec cucumber features` both scenar
2 scenarios (2 passed)
4 steps (4 passed)
+
+If we want to add more options later on, we can define them by using the `method_options` helper like this:
+
+ method_options :word => :string, :uppercase => :boolean
+ def pluralize
+ # accessed as options[:word], options[:uppercase]
+ end
+
+In this example, `options[:word]` will return a `String` object, whilst `options[:uppercase]` will return either `true` or `false`, depending on the value it has received.
This introduction should have whet your appetite to learn more about Thor and it's encouraged that you do that now. Check out `Bundler::CLI` for a great example of using Thor as a CLI tool.
Please sign in to comment.
Something went wrong with that request. Please try again.