Module: Habject::Hash

Defined in:
lib/habject.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



4
5
6
7
8
# File 'lib/habject.rb', line 4

def method_missing(name)
  return self[name.to_s] if key? name.to_s
  return self[name.to_sym] if key? name.to_sym
  super
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/habject.rb', line 10

def respond_to?(method)
  has_key?(method.to_s) || super
end