Module: Cowtech::Extensions::Hash

Extended by:
ActiveSupport::Concern
Defined in:
lib/cowtech-extensions/hash.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



12
13
14
# File 'lib/cowtech-extensions/hash.rb', line 12

def method_missing(method, *args, &block)
	(self.has_key?(method.to_sym) || self.has_key?(method.to_s)) ? (self[method.to_sym] || self[method.to_s]) : super(method, *args, &block)
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

Returns:



16
17
18
# File 'lib/cowtech-extensions/hash.rb', line 16

def respond_to?(method)
	(self.has_key?(method.to_sym) || self.has_key?(method.to_s)) ? true : super(method)
end