Class: Twitter::Base
- Inherits:
-
Object
- Object
- Twitter::Base
- Defined in:
- lib/twitter/base.rb
Direct Known Subclasses
Action, Configuration, Cursor, DirectMessage, Entity, Language, List, Metadata, OEmbed, Photo, Place, Point, Polygon, RateLimitStatus, Relationship, SavedSearch, Settings, Size, Status, Suggestion, Trend, User
Instance Attribute Summary (collapse)
-
- (Object) attrs
(also: #to_hash)
Returns the value of attribute attrs.
Class Method Summary (collapse)
-
+ (Object) lazy_attr_reader(*attrs)
Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key.
Instance Method Summary (collapse)
-
- (Object) [](method)
Initializes a new Base object.
-
- (Twitter::Base) initialize(attrs = {})
constructor
Initializes a new Base object.
Constructor Details
- (Twitter::Base) initialize(attrs = {})
Initializes a new Base object
26 27 28 |
# File 'lib/twitter/base.rb', line 26 def initialize(attrs={}) @attrs = attrs.dup end |
Instance Attribute Details
- (Object) attrs Also known as: to_hash
Returns the value of attribute attrs
3 4 5 |
# File 'lib/twitter/base.rb', line 3 def attrs @attrs end |
Class Method Details
+ (Object) self.lazy_attr_reader(attr) + (Object) self.lazy_attr_reader(attrs)
Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key
12 13 14 15 16 17 18 19 20 |
# File 'lib/twitter/base.rb', line 12 def self.lazy_attr_reader(*attrs) attrs.each do |attribute| class_eval do define_method attribute do @attrs[attribute.to_s] end end end end |
Instance Method Details
- (Object) [](method)
Initializes a new Base object
33 34 35 36 37 |
# File 'lib/twitter/base.rb', line 33 def [](method) self.__send__(method.to_sym) rescue NoMethodError nil end |