class Fuelcell::Action::OptResults

Public Class Methods

new(hash = {}) click to toggle source
Calls superclass method
# File lib/fuelcell/action/opt_results.rb, line 5
def initialize(hash = {})
  super()
  hash.each do |key, value|
    self[normalize(key)] = value
  end
end

Public Instance Methods

[](key) click to toggle source
Calls superclass method
# File lib/fuelcell/action/opt_results.rb, line 12
def [](key)
  super(normalize(key))
end
[]=(key, value) click to toggle source
Calls superclass method
# File lib/fuelcell/action/opt_results.rb, line 16
def []=(key, value)
  super(normalize(key), value)
end
delete(key) click to toggle source
Calls superclass method
# File lib/fuelcell/action/opt_results.rb, line 20
def delete(key)
  super(normalize(key))
end
fetch(key, *args) click to toggle source
Calls superclass method
# File lib/fuelcell/action/opt_results.rb, line 24
def fetch(key, *args)
  super(normalize(key), *args)
end
key?(key) click to toggle source
Calls superclass method
# File lib/fuelcell/action/opt_results.rb, line 28
def key?(key)
  super(normalize(key))
end
merge(hash) click to toggle source
# File lib/fuelcell/action/opt_results.rb, line 36
def merge(hash)
  dup.merge!(hash)
end
merge!(hash) click to toggle source
# File lib/fuelcell/action/opt_results.rb, line 40
def merge!(hash)
  hash.each do |key, value|
    self[normalize(key)] = value
  end
  self
end
respond_to?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/fuelcell/action/opt_results.rb, line 51
def respond_to?(method_name, include_private = false)
  return key?(method_name.to_s.chomp('?')) || super
end
to_hash() click to toggle source
# File lib/fuelcell/action/opt_results.rb, line 47
def to_hash
  Hash.new(default).merge!(self)
end
values_at(*indices) click to toggle source
# File lib/fuelcell/action/opt_results.rb, line 32
def values_at(*indices)
  indices.map { |key| self[normalize(key)] }
end

Protected Instance Methods

method_missing(method_name, *args, &_block) click to toggle source
# File lib/fuelcell/action/opt_results.rb, line 61
def method_missing(method_name, *args, &_block)
  name = method_name.to_s
  return self.key?(name.chomp('?')) if name[-1] == '?'
  return self[name]
end
normalize(key) click to toggle source
# File lib/fuelcell/action/opt_results.rb, line 57
def normalize(key)
  key.is_a?(Symbol) ? key.to_s : key
end