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.
-
#category ⇒ Object
Returns the value of attribute category.
-
#clone_blocks ⇒ Object
Returns the value of attribute clone_blocks.
-
#clone_parent ⇒ Object
Returns the value of attribute clone_parent.
-
#cloneable ⇒ Object
Returns the value of attribute cloneable.
-
#content ⇒ Object
Returns the value of attribute content.
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#entity_association ⇒ Object
Returns the value of attribute entity_association.
-
#entity_clone ⇒ Object
Returns the value of attribute entity_clone.
-
#entity_container ⇒ Object
Returns the value of attribute entity_container.
-
#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.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/block.rb', line 5 def initialize(id, items) item = items[id] @id = id @content = item['content'] @category = item['category'] @entity = item['entity'] @entity_association = item['entityAssociation'] @entity_container = item['entityContainer'] @attribute = item['attribute'] @type = item['type'] @association = item['association'] @entity_clone = item['entityClone'] @cloneable = item['cloneable'] @clone_blocks = item['cloneChildren'] @clone_parent = item['cloneParent'].to_s @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 |
#category ⇒ Object
Returns the value of attribute category.
2 3 4 |
# File 'lib/block.rb', line 2 def category @category end |
#clone_blocks ⇒ Object
Returns the value of attribute clone_blocks.
2 3 4 |
# File 'lib/block.rb', line 2 def clone_blocks @clone_blocks end |
#clone_parent ⇒ Object
Returns the value of attribute clone_parent.
2 3 4 |
# File 'lib/block.rb', line 2 def clone_parent @clone_parent end |
#cloneable ⇒ Object
Returns the value of attribute cloneable.
2 3 4 |
# File 'lib/block.rb', line 2 def cloneable @cloneable end |
#content ⇒ Object
Returns the value of attribute content.
2 3 4 |
# File 'lib/block.rb', line 2 def content @content end |
#entity ⇒ Object
Returns the value of attribute entity.
2 3 4 |
# File 'lib/block.rb', line 2 def entity @entity end |
#entity_association ⇒ Object
Returns the value of attribute entity_association.
2 3 4 |
# File 'lib/block.rb', line 2 def entity_association @entity_association end |
#entity_clone ⇒ Object
Returns the value of attribute entity_clone.
2 3 4 |
# File 'lib/block.rb', line 2 def entity_clone @entity_clone end |
#entity_container ⇒ Object
Returns the value of attribute entity_container.
2 3 4 |
# File 'lib/block.rb', line 2 def entity_container @entity_container 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
27 28 29 |
# File 'lib/block.rb', line 27 def self.all ObjectSpace.each_object(self).to_a end |
.find(id) ⇒ Object
31 32 33 |
# File 'lib/block.rb', line 31 def self.find(id) all.find { |block| block.id == id } end |