Class: Net::Twitter::Status::Features

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/net/twitter/status.rb

Instance Method Summary collapse

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

#eachObject



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

#namesObject



27
28
29
30
31
# File 'lib/net/twitter/status.rb', line 27

def names
  map do |feature|
    feature.name
  end
end

#sizeObject



23
24
25
# File 'lib/net/twitter/status.rb', line 23

def size
  @elements.size
end