Class: Miniparse::Option
Overview
TODO FEATURE consider doing unambiguous matches for shortened options TODO FEATURE consider the option default value setting the type
Direct Known Subclasses
Instance Attribute Summary collapse
-
#shortable ⇒ Object
readonly
Returns the value of attribute shortable.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
#help_desc, #initialize, #run, spec_to_name, valid_spec
Constructor Details
This class inherits a constructor from Miniparse::Command
Instance Attribute Details
#shortable ⇒ Object (readonly)
Returns the value of attribute shortable.
91 92 93 |
# File 'lib/miniparse/command.rb', line 91 def shortable @shortable end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
91 92 93 |
# File 'lib/miniparse/command.rb', line 91 def value @value end |
Instance Method Details
#arg_to_value(arg) ⇒ Object
97 98 99 |
# File 'lib/miniparse/command.rb', line 97 def arg_to_value(arg) raise NotImplementedError, "#{self.class} cannot respond to '#{__method__}'" end |
#check(arg) ⇒ Object
93 94 95 |
# File 'lib/miniparse/command.rb', line 93 def check(arg) arg_to_value(arg) != nil end |
#help_usage ⇒ Object
110 111 112 |
# File 'lib/miniparse/command.rb', line 110 def help_usage raise NotImplementedError, "#{self.class} cannot respond to '#{__method__}'" end |
#parse_value(arg) ⇒ Object
101 102 103 104 105 106 107 108 |
# File 'lib/miniparse/command.rb', line 101 def parse_value(arg) val = arg_to_value(arg) if val != nil @value = val run(val) end val end |