Module

Rails::Generator::Options

Inheritance

Classes & Modules

Attributes

Name Visibility R/W Description
options public W

Methods

Class

Visibility Signature
public included (base)

Instance

Visibility Signature
public options ()
protected add_general_options! (opt)
protected add_options! (opt)
protected banner ()
protected default_options ()
protected full_options (runtime_options = {})
protected mandatory_options ()
protected parse! (args, runtime_options = {})
protected usage (message = usage_message)
protected usage_message ()

Class Method Detail

included(base)

Instance Method Detail

options()

Each instance has an options hash that‘s populated by parse.

add_general_options!(opt)

Adds general options like -h and —quiet. Usually don‘t override.

add_options!(opt)

Override to add your options to the parser:

  def add_options!(opt)
    opt.on('-v', '--verbose') { |value| options[:verbose] = value }
  end

banner()

Override with your own usage banner.

default_options()

Convenient access to class default options.

full_options(runtime_options = {})

Merge together our instance options. In increasing precedence:

  default_options   (class default options)
  options           (instance options)
  runtime_options   (provided as argument)
  mandatory_options (class mandatory options)

mandatory_options()

Convenient access to class mandatory options.

parse!(args, runtime_options = {})

Parse arguments into the options hash. Classes may customize parsing behavior by overriding these methods:

  #banner                 Usage: ./script/generate [options]
  #add_options!           Options:
                            some options..
  #add_general_options!   General Options:
                            general options..

usage(message = usage_message)

Raise a usage error. Override usage_message to provide a blurb after the option parser summary.

usage_message()