Class: Content
- Inherits:
-
Object
- Object
- Content
- Defined in:
- lib/content.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #find(name) ⇒ Object
-
#initialize(data) ⇒ Content
constructor
A new instance of Content.
Constructor Details
#initialize(data) ⇒ Content
Returns a new instance of Content.
4 5 6 |
# File 'lib/content.rb', line 4 def initialize(data) @items = data.map {|item| ContentItem.new item} end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
2 3 4 |
# File 'lib/content.rb', line 2 def items @items end |
Instance Method Details
#find(name) ⇒ Object
8 9 10 |
# File 'lib/content.rb', line 8 def find(name) @items.select {|i| i.name == name}.first end |