Class: TweetStream::Hash

Inherits:
Hash
  • Object
show all
Defined in:
lib/tweetstream/hash.rb

Overview

:nodoc: all

Direct Known Subclasses

Status, User

Instance Method Summary collapse

Constructor Details

#initialize(other_hash = {}) ⇒ Hash

Returns a new instance of Hash.



2
3
4
5
6
# File 'lib/tweetstream/hash.rb', line 2

def initialize(other_hash = {})
  other_hash.keys.each do |key|
    self[key.to_sym] = other_hash[key]
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



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

def method_missing(method_name, *args)
  if key?(method_name.to_sym)
    self[method_name.to_sym]
  else
    super
  end
end