Class: YAML::Transformer::Root
- Defined in:
- lib/yaml_extensions/transform.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Instance Method Summary collapse
- #dottify(stream) ⇒ Object
-
#initialize ⇒ Root
constructor
A new instance of Root.
- #to_s ⇒ Object (also: #unique_name)
Constructor Details
#initialize ⇒ Root
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
#children ⇒ Object (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_s ⇒ Object Also known as: unique_name
169 170 171 |
# File 'lib/yaml_extensions/transform.rb', line 169 def to_s 'root' end |