Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/rasm/core_ext/hash.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



11
12
13
14
# File 'lib/rasm/core_ext/hash.rb', line 11

def method_missing(method, *args)
  return self[method] if args.empty? && self.include?(method)
  super
end

Instance Method Details

#ref(selector, options = {}) ⇒ Object



3
4
5
# File 'lib/rasm/core_ext/hash.rb', line 3

def ref(selector, options = {})
  Rasm::Ref.new(self, selector, options)
end

#respond_to_missing?(method) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/rasm/core_ext/hash.rb', line 7

def respond_to_missing?(method, *)
  self.key?(method) || super
end