Class: Maglev::Section::Block::Store

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
app/models/maglev/section/block.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#arrayObject (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