Class: AutoColors::MapEntry
- Inherits:
-
Object
- Object
- AutoColors::MapEntry
- Defined in:
- lib/autocolors/mapping.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#data ⇒ Object
Returns the value of attribute data.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #children_size ⇒ Object
- #depth ⇒ Object
-
#initialize(name, data) ⇒ MapEntry
constructor
A new instance of MapEntry.
Constructor Details
#initialize(name, data) ⇒ MapEntry
Returns a new instance of MapEntry.
8 9 10 11 12 13 |
# File 'lib/autocolors/mapping.rb', line 8 def initialize(name, data) @name = name @data = data @parent = nil @children = [] end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
7 8 9 |
# File 'lib/autocolors/mapping.rb', line 7 def children @children end |
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/autocolors/mapping.rb', line 7 def data @data end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/autocolors/mapping.rb', line 7 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
7 8 9 |
# File 'lib/autocolors/mapping.rb', line 7 def parent @parent end |
Instance Method Details
#children_size ⇒ Object
19 20 21 |
# File 'lib/autocolors/mapping.rb', line 19 def children_size @children.size + @children.reduce(0){|t,c| t + c.children_size} end |
#depth ⇒ Object
15 16 17 |
# File 'lib/autocolors/mapping.rb', line 15 def depth @name.count('.') end |