Class: Net::Twitter::Status::Features
- Inherits:
-
Object
- Object
- Net::Twitter::Status::Features
- Includes:
- Enumerable
- Defined in:
- lib/net/twitter/status.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #each ⇒ Object
-
#initialize(elements) ⇒ Features
constructor
A new instance of Features.
- #names ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(elements) ⇒ Features
Returns a new instance of Features.
13 14 15 |
# File 'lib/net/twitter/status.rb', line 13 def initialize(elements) @elements = elements end |
Instance Method Details
#[](name) ⇒ Object
33 34 35 36 37 |
# File 'lib/net/twitter/status.rb', line 33 def [](name) find do |feature| feature.name == name end end |
#each ⇒ Object
17 18 19 20 21 |
# File 'lib/net/twitter/status.rb', line 17 def each @elements.each do |element| yield Feature.new(element) end end |
#names ⇒ Object
27 28 29 30 31 |
# File 'lib/net/twitter/status.rb', line 27 def names map do |feature| feature.name end end |
#size ⇒ Object
23 24 25 |
# File 'lib/net/twitter/status.rb', line 23 def size @elements.size end |