Class: Brainstem::TestHelpers::BrainstemDataHelper::BrainstemHelperCollection
- Inherits:
-
Array
- Object
- Array
- Brainstem::TestHelpers::BrainstemDataHelper::BrainstemHelperCollection
show all
- Defined in:
- lib/brainstem/test_helpers.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BrainstemHelperCollection.
51
52
53
54
55
|
# File 'lib/brainstem/test_helpers.rb', line 51
def initialize(collection)
collection.each do |item|
self << BrainstemHelperItem.new(item)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
65
66
67
|
# File 'lib/brainstem/test_helpers.rb', line 65
def method_missing(name)
map { |item| item.send(name.to_s.singularize) }
end
|
Instance Method Details
#by_id(id) ⇒ Object
61
62
63
|
# File 'lib/brainstem/test_helpers.rb', line 61
def by_id(id)
detect { |item| item.id == id.to_s }
end
|
#ids ⇒ Object
57
58
59
|
# File 'lib/brainstem/test_helpers.rb', line 57
def ids
map { |item| item.id }
end
|