Class: Arena::Base
- Inherits:
-
Object
- Object
- Arena::Base
- Defined in:
- lib/arena/base.rb
Direct Known Subclasses
Account, Block, Channel, ChannelFeed, Comment, Connection, Entity, Feed, Results, SearchResults, Story, User, UserFeed
Instance Attribute Summary collapse
-
#attrs ⇒ Object
(also: #to_hash)
readonly
Returns the value of attribute attrs.
Class Method Summary collapse
-
.attr_reader(*attrs) ⇒ Object
Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Arena::Base
constructor
Initializes a new object.
Constructor Details
#initialize(attrs = {}) ⇒ Arena::Base
Initializes a new object
25 26 27 |
# File 'lib/arena/base.rb', line 25 def initialize(attrs={}) @attrs = attrs end |
Instance Attribute Details
#attrs ⇒ Object (readonly) Also known as: to_hash
Returns the value of attribute attrs.
3 4 5 |
# File 'lib/arena/base.rb', line 3 def attrs @attrs end |
Class Method Details
.attr_reader(*attrs) ⇒ Object
Define methods that retrieve the value from an initialized instance variable Hash, using the attribute as a key
11 12 13 14 15 16 17 18 19 |
# File 'lib/arena/base.rb', line 11 def self.attr_reader(*attrs) attrs.each do |attribute| class_eval do define_method attribute do @attrs[attribute.to_s] end end end end |