Class: GoogleCSE::Result

Inherits:
Hash
  • Object
show all
Defined in:
lib/google_cse/result.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}, default = nil, &block) ⇒ Result

Returns a new instance of Result.



3
4
5
6
# File 'lib/google_cse/result.rb', line 3

def initialize(hash = {}, default = nil, &block)
  default ? super(default) : super(&block)
  update(hash)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



8
9
10
11
12
13
14
# File 'lib/google_cse/result.rb', line 8

def method_missing name, *args, &block
  if self.key?(name.to_s)
    self[name.to_s]
  else
    super
  end
end