Class: Fuelcell::Action::ArgResults

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/fuelcell/action/arg_results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(array, hash) ⇒ ArgResults

Returns a new instance of ArgResults.



8
9
10
# File 'lib/fuelcell/action/arg_results.rb', line 8

def initialize(array, hash)
  @raw, @map = validate_results(array, hash)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &_block) ⇒ Object (protected)



21
22
23
24
25
# File 'lib/fuelcell/action/arg_results.rb', line 21

def method_missing(method, *args, &_block)
  method = method.to_s
  return map.key?(method.chomp('?')) if method[-1] == '?'
  value(method)
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/fuelcell/action/arg_results.rb', line 5

def raw
  @raw
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
16
# File 'lib/fuelcell/action/arg_results.rb', line 13

def [](key)
  return raw[key] if key.is_a?(Integer)
  value(key)
end