Module: Jschematic::Composite

Includes:
Enumerable, Element
Included in:
Attributes::Properties, Schema
Defined in:
lib/jschematic/composite.rb

Instance Attribute Summary

Attributes included from Element

#id, #parent

Instance Method Summary collapse

Methods included from Element

#required?, #schema_for, #title, #to_s

Instance Method Details

#add_child(child) ⇒ Object



12
13
14
15
# File 'lib/jschematic/composite.rb', line 12

def add_child(child)
  child.parent = self
  children << child
end

#childrenObject



8
9
10
# File 'lib/jschematic/composite.rb', line 8

def children
  @children ||= []
end

#each(&block) ⇒ Object



17
18
19
20
# File 'lib/jschematic/composite.rb', line 17

def each(&block)
  block.call(self)
  children.each{ |child| child.each(&block) }
end