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.
62 63 64 65 |
# File 'lib/more/facets/getoptlong.rb', line 62 def initialize(&block) @arguments = [] instance_eval(&block) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
60 61 62 |
# File 'lib/more/facets/getoptlong.rb', line 60 def arguments @arguments end |
Instance Method Details
#flag(*opts) ⇒ Object
67 68 69 |
# File 'lib/more/facets/getoptlong.rb', line 67 def flag(*opts) @arguments << (opts << GetoptLong::NO_ARGUMENT) end |
#optional(*opts) ⇒ Object Also known as: opts
76 77 78 |
# File 'lib/more/facets/getoptlong.rb', line 76 def optional(*opts) @arguments << (opts << GetoptLong::OPTIONAL_ARGUMENT) end |
#required(*opts) ⇒ Object Also known as: reqs
71 72 73 |
# File 'lib/more/facets/getoptlong.rb', line 71 def required(*opts) @arguments << (opts << GetoptLong::REQUIRED_ARGUMENT) end |