Class: Block
- Inherits:
-
Object
- Object
- Block
- Defined in:
- lib/block.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
Returns the value of attribute association.
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#attribute_container ⇒ Object
Returns the value of attribute attribute_container.
-
#category ⇒ Object
Returns the value of attribute category.
-
#content ⇒ Object
Returns the value of attribute content.
-
#id ⇒ Object
Returns the value of attribute id.
-
#sub_blocks ⇒ Object
Returns the value of attribute sub_blocks.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id, items) ⇒ Block
constructor
A new instance of Block.
Constructor Details
#initialize(id, items) ⇒ Block
Returns a new instance of Block.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/block.rb', line 4 def initialize(id, items) item = items[id] @id = id @content = item['content'] @category = item['category'] @attribute_container = item['attributeContainer'] @attribute = item['attribute'] @type = item['type'] @association = item['association'] @sub_blocks = [] item['subItemIds'].each do |sub_item_id| sub_item_id = sub_item_id.to_s @sub_blocks << Block.new(sub_item_id, items) end end |
Instance Attribute Details
#association ⇒ Object
Returns the value of attribute association.
2 3 4 |
# File 'lib/block.rb', line 2 def association @association end |
#attribute ⇒ Object
Returns the value of attribute attribute.
2 3 4 |
# File 'lib/block.rb', line 2 def attribute @attribute end |
#attribute_container ⇒ Object
Returns the value of attribute attribute_container.
2 3 4 |
# File 'lib/block.rb', line 2 def attribute_container @attribute_container end |
#category ⇒ Object
Returns the value of attribute category.
2 3 4 |
# File 'lib/block.rb', line 2 def category @category end |
#content ⇒ Object
Returns the value of attribute content.
2 3 4 |
# File 'lib/block.rb', line 2 def content @content end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/block.rb', line 2 def id @id end |
#sub_blocks ⇒ Object
Returns the value of attribute sub_blocks.
2 3 4 |
# File 'lib/block.rb', line 2 def sub_blocks @sub_blocks end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'lib/block.rb', line 2 def type @type end |
Class Method Details
.all ⇒ Object
20 21 22 |
# File 'lib/block.rb', line 20 def self.all ObjectSpace.each_object(self).to_a end |
.find(id) ⇒ Object
24 25 26 |
# File 'lib/block.rb', line 24 def self.find(id) all.each { |block| return block if block.id == id } end |