Class: Eastrails::Parameters
- Inherits:
-
Object
- Object
- Eastrails::Parameters
- Defined in:
- lib/eastrails/parameters.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#non_options ⇒ Object
Returns the value of attribute non_options.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #command ⇒ Object
- #component ⇒ Object
-
#initialize(args = []) ⇒ Parameters
constructor
A new instance of Parameters.
- #parse_options ⇒ Object
Constructor Details
#initialize(args = []) ⇒ Parameters
Returns a new instance of Parameters.
7 8 9 10 11 |
# File 'lib/eastrails/parameters.rb', line 7 def initialize(args = []) self.args = args.dup self. = args.select { |arg| !arg.start_with?("-") } end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3 4 5 |
# File 'lib/eastrails/parameters.rb', line 3 def args @args end |
#non_options ⇒ Object
Returns the value of attribute non_options.
5 6 7 |
# File 'lib/eastrails/parameters.rb', line 5 def @non_options end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/eastrails/parameters.rb', line 4 def @options end |
Instance Method Details
#command ⇒ Object
29 30 31 |
# File 'lib/eastrails/parameters.rb', line 29 def command [0] || "help" end |
#component ⇒ Object
33 34 35 |
# File 'lib/eastrails/parameters.rb', line 33 def component [1] end |
#parse_options ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/eastrails/parameters.rb', line 13 def self. = {} parser = OptionParser.new do |opts| opts.on('-v', '--verbose', 'Print debugging details') do [:verbose] = true end opts.on('-b', '--bundle', 'Run bundle after complete') do [:bundle] = true end opts.on('-d', '--database', "Specify the database adapter as of eastrails new") end parser.parse!(args) end |