Class: YAML::Transformer::Root

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml_extensions/transform.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRoot

Returns a new instance of Root.



156
157
158
159
# File 'lib/yaml_extensions/transform.rb', line 156

def initialize
  @name = 'root'
  @children = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



154
155
156
# File 'lib/yaml_extensions/transform.rb', line 154

def children
  @children
end

Instance Method Details

#dottify(stream) ⇒ Object



161
162
163
164
165
166
167
# File 'lib/yaml_extensions/transform.rb', line 161

def dottify ( stream )
  stream << "#{self} [shape=circle, color=red, label=#{self}]\n"
  stream << "#{self} -> { rank=same; "
  @children.each { |e| stream << "#{e.unique_name} " }
  stream << "}\n"
  @children.each { |e| e.dottify(stream) }
end

#to_sObject Also known as: unique_name



169
170
171
# File 'lib/yaml_extensions/transform.rb', line 169

def to_s
  'root'
end