Class: TweetStream::Hash
- Inherits:
-
Hash
- Object
- Hash
- TweetStream::Hash
- Defined in:
- lib/tweetstream/hash.rb
Overview
:nodoc: all
Instance Method Summary collapse
-
#initialize(other_hash = {}) ⇒ Hash
constructor
A new instance of Hash.
- #method_missing(method_name, *args) ⇒ Object
Constructor Details
#initialize(other_hash = {}) ⇒ Hash
Returns a new instance of Hash.
2 3 4 5 6 7 8 |
# File 'lib/tweetstream/hash.rb', line 2 def initialize(other_hash = {}) other_hash.keys.each do |key| value = other_hash[key] value = TweetStream::Hash.new(value) if value.is_a?(::Hash) self[key.to_sym] = value end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/tweetstream/hash.rb', line 10 def method_missing(method_name, *args) if key?(method_name.to_sym) self[method_name.to_sym] else super end end |