class Finix::IndifferentHash

Public Class Methods

new(*args) click to toggle source
# File lib/finix/indifferent_hash.rb, line 4
def initialize(*args)
  original_hash = args.slice!(0) || {}
  self.merge!(original_hash)
end

Public Instance Methods

count(*args) click to toggle source
Calls superclass method
# File lib/finix/indifferent_hash.rb, line 17
def count(*args)
  if self.has_key? 'count'
    raise Exception.new 'Unsupported block_given exception' if block_given?
    return self.send :method_missing, :count, *args
  end
  super(*args)
end
method_missing(method, *args, &block) click to toggle source
# File lib/finix/indifferent_hash.rb, line 9
def method_missing(method, *args, &block)
  if self.has_key? "#{method}"
    value = self["#{method}"]
    return value.call(*args) if value.respond_to? :call
    return value
  end
end