method
add_options!
v2.0.3 -
Show latest stable
- Class:
Rails::Generator::Options
add_options!(opt)protected
Override to add your options to the parser:
def add_options!(opt) opt.on('-v', '--verbose') { |value| options[:verbose] = value } end
1Note
If you need to pass a value
In the above example 'value' happens to be either true or false depending if the option was passed in or not. If you wish to capture an actual value you'll want something like this:
def add_options!(opt)
opt.on('-option=value') { |value| options[:option] = value }
end