Class: Maglev::Section::Block::Store
- Inherits:
-
Object
- Object
- Maglev::Section::Block::Store
- Includes:
- Enumerable
- Defined in:
- app/models/maglev/section/block.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #find(type) ⇒ Object
-
#initialize(blocks, section:) ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize(blocks, section:) ⇒ Store
Returns a new instance of Store.
69 70 71 |
# File 'app/models/maglev/section/block.rb', line 69 def initialize(blocks, section:) @array = ::Maglev::Section::Block.build_many(blocks, section: section) end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
67 68 69 |
# File 'app/models/maglev/section/block.rb', line 67 def array @array end |
Instance Method Details
#each(&block) ⇒ Object
77 78 79 |
# File 'app/models/maglev/section/block.rb', line 77 def each(&block) array.each(&block) end |
#find(type) ⇒ Object
73 74 75 |
# File 'app/models/maglev/section/block.rb', line 73 def find(type) array.find { |block| block.type == type } end |