Class: Optio::Switch
- Inherits:
-
Object
- Object
- Optio::Switch
- Defined in:
- lib/optio/switch.rb
Instance Method Summary collapse
-
#initialize(name, opts) ⇒ Switch
constructor
TODO mandatory switch.
- #rb_parser_args ⇒ Object
Constructor Details
#initialize(name, opts) ⇒ Switch
TODO mandatory switch
5 6 7 8 |
# File 'lib/optio/switch.rb', line 5 def initialize(name, opts) @name = name @opts = opts end |
Instance Method Details
#rb_parser_args ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/optio/switch.rb', line 10 def rb_parser_args args = ["--#{@name} #{@name.upcase}"] if @opts[:short] args.unshift("-#{@opts[:short]} #{@name.upcase}") end [:type, :desc].each do |key| if @opts[key] args << @opts[key] end end args end |