Class: Tweetkit::Response::Tweet

Inherits:
Object
  • Object
show all
Defined in:
lib/tweetkit/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tweet) ⇒ Tweet

Returns a new instance of Tweet.



136
137
138
# File 'lib/tweetkit/response.rb', line 136

def initialize(tweet)
  @tweet = tweet
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(attribute) ⇒ Object



140
141
142
143
# File 'lib/tweetkit/response.rb', line 140

def method_missing(attribute)
  data = tweet[attribute.to_s]
  data.empty? ? super : data
end

Instance Attribute Details

#tweetObject

Returns the value of attribute tweet.



134
135
136
# File 'lib/tweetkit/response.rb', line 134

def tweet
  @tweet
end

Instance Method Details

#respond_to_missing?(method, *args) ⇒ Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/tweetkit/response.rb', line 145

def respond_to_missing?(method, *args)
  tweet.respond_to?(method) || super
end