Class: Ragol::Results
- Inherits:
-
Object
- Object
- Ragol::Results
- Includes:
- Logue::Loggable
- Defined in:
- lib/ragol/results.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #args ⇒ Object
- #args_empty? ⇒ Boolean
- #current_arg ⇒ Object
- #end_of_options? ⇒ Boolean
-
#initialize(options, args = Array.new) ⇒ Results
constructor
A new instance of Results.
- #next_arg ⇒ Object
- #set_value(optname, value) ⇒ Object
- #shift_arg ⇒ Object
- #unprocessed ⇒ Object
- #unset_value(optname) ⇒ Object
- #value(optname) ⇒ Object
Constructor Details
#initialize(options, args = Array.new) ⇒ Results
Returns a new instance of Results.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ragol/results.rb', line 14 def initialize , args = Array.new @argslist = Ragol::ArgsList.new(args) @values = Hash.new .each do |option| @values[option.name] = option.default define_singleton_method option.name do instance_eval do @values[option.name] end end end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/ragol/results.rb', line 12 def @options end |
Instance Method Details
#args ⇒ Object
49 50 51 |
# File 'lib/ragol/results.rb', line 49 def args @argslist.args end |
#args_empty? ⇒ Boolean
61 62 63 |
# File 'lib/ragol/results.rb', line 61 def args_empty? @argslist.args_empty? end |
#current_arg ⇒ Object
65 66 67 |
# File 'lib/ragol/results.rb', line 65 def current_arg @argslist.current_arg end |
#end_of_options? ⇒ Boolean
45 46 47 |
# File 'lib/ragol/results.rb', line 45 def @argslist. end |
#next_arg ⇒ Object
53 54 55 |
# File 'lib/ragol/results.rb', line 53 def next_arg @argslist.next_arg end |
#set_value(optname, value) ⇒ Object
33 34 35 |
# File 'lib/ragol/results.rb', line 33 def set_value optname, value @values[optname] = value end |
#shift_arg ⇒ Object
57 58 59 |
# File 'lib/ragol/results.rb', line 57 def shift_arg @argslist.shift_arg end |
#unprocessed ⇒ Object
41 42 43 |
# File 'lib/ragol/results.rb', line 41 def unprocessed @argslist end |
#unset_value(optname) ⇒ Object
37 38 39 |
# File 'lib/ragol/results.rb', line 37 def unset_value optname @values.delete optname end |
#value(optname) ⇒ Object
29 30 31 |
# File 'lib/ragol/results.rb', line 29 def value optname @values[optname] end |