Class: GetoptLong::DSL
Overview
DSL-mode parser.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
Instance Method Summary collapse
- #flag(*opts) ⇒ Object
-
#initialize(&block) ⇒ DSL
constructor
A new instance of DSL.
- #optional(*opts) ⇒ Object (also: #opts)
- #required(*opts) ⇒ Object (also: #reqs)
Constructor Details
#initialize(&block) ⇒ DSL
Returns a new instance of DSL.
31 32 33 34 |
# File 'lib/standard/facets/getoptlong.rb', line 31 def initialize(&block) @arguments = [] instance_eval(&block) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
29 30 31 |
# File 'lib/standard/facets/getoptlong.rb', line 29 def arguments @arguments end |
Instance Method Details
#flag(*opts) ⇒ Object
37 38 39 |
# File 'lib/standard/facets/getoptlong.rb', line 37 def flag(*opts) @arguments << (opts << GetoptLong::NO_ARGUMENT) end |
#optional(*opts) ⇒ Object Also known as: opts
50 51 52 |
# File 'lib/standard/facets/getoptlong.rb', line 50 def optional(*opts) @arguments << (opts << GetoptLong::OPTIONAL_ARGUMENT) end |
#required(*opts) ⇒ Object Also known as: reqs
42 43 44 |
# File 'lib/standard/facets/getoptlong.rb', line 42 def required(*opts) @arguments << (opts << GetoptLong::REQUIRED_ARGUMENT) end |