Class: AutoColors::MapEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/autocolors/mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#childrenObject

Returns the value of attribute children.



7
8
9
# File 'lib/autocolors/mapping.rb', line 7

def children
  @children
end

#dataObject

Returns the value of attribute data.



7
8
9
# File 'lib/autocolors/mapping.rb', line 7

def data
  @data
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/autocolors/mapping.rb', line 7

def name
  @name
end

#parentObject

Returns the value of attribute parent.



7
8
9
# File 'lib/autocolors/mapping.rb', line 7

def parent
  @parent
end

Instance Method Details

#children_sizeObject



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

#depthObject



15
16
17
# File 'lib/autocolors/mapping.rb', line 15

def depth
  @name.count('.')
end