Class: RShade::EventTreeNode

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rshade/event_tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, level, parent = nil) ⇒ EventTreeNode

Returns a new instance of EventTreeNode.



50
51
52
53
54
55
56
# File 'lib/rshade/event_tree.rb', line 50

def initialize(value, level, parent=nil)
  @children = []
  @level = level
  @parent = parent
  @value = value
  @vlevel = set_vlevel(parent)
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



47
48
49
# File 'lib/rshade/event_tree.rb', line 47

def children
  @children
end

#levelObject (readonly)

Returns the value of attribute level.



47
48
49
# File 'lib/rshade/event_tree.rb', line 47

def level
  @level
end

#parentObject

Returns the value of attribute parent.



48
49
50
# File 'lib/rshade/event_tree.rb', line 48

def parent
  @parent
end

#valueObject (readonly)

Returns the value of attribute value.



47
48
49
# File 'lib/rshade/event_tree.rb', line 47

def value
  @value
end

#vlevelObject (readonly)

Returns the value of attribute vlevel.



47
48
49
# File 'lib/rshade/event_tree.rb', line 47

def vlevel
  @vlevel
end

Instance Method Details

#each(&block) ⇒ Object



58
59
60
61
# File 'lib/rshade/event_tree.rb', line 58

def each(&block)
  block.call(self) if parent != nil || value != nil
  children.each { |item| item.each(&block) }
end