Class: StatSailr::Output::OutputNode

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/statsailr/sts_output/output_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, parent) ⇒ OutputNode

Returns a new instance of OutputNode.



69
70
71
72
73
74
# File 'lib/statsailr/sts_output/output_manager.rb', line 69

def initialize(tag , parent)
  @tag = tag
  @children = []
  @parent = parent
  @messages = []
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages.



68
69
70
# File 'lib/statsailr/sts_output/output_manager.rb', line 68

def messages
  @messages
end

#parentObject (readonly)

Returns the value of attribute parent.



68
69
70
# File 'lib/statsailr/sts_output/output_manager.rb', line 68

def parent
  @parent
end

#tagObject (readonly)

Returns the value of attribute tag.



68
69
70
# File 'lib/statsailr/sts_output/output_manager.rb', line 68

def tag
  @tag
end

Instance Method Details

#each_message(&blk) ⇒ Object



90
91
92
# File 'lib/statsailr/sts_output/output_manager.rb', line 90

def each_message(&blk)
  @messages.each(&blk)
end

#each_node(&blk) ⇒ Object



86
87
88
# File 'lib/statsailr/sts_output/output_manager.rb', line 86

def each_node(&blk)
  @children.each(&blk)
end

#new_message(type, content) ⇒ Object



81
82
83
84
# File 'lib/statsailr/sts_output/output_manager.rb', line 81

def new_message( type, content )
  @messages << OutputMessage.new(type, content, self )
  return @messages.last
end

#new_node(tag) ⇒ Object



76
77
78
79
# File 'lib/statsailr/sts_output/output_manager.rb', line 76

def new_node(tag)
  @children << OutputNode.new(tag, self)
  return @children.last
end

#to_sObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/statsailr/sts_output/output_manager.rb', line 94

def to_s()
  str = ""
  if ! @messages.empty?
    each_message(){|message|
      str << message.to_s()
    }
  end
  if ! @children.empty?
    each_node(){|node|
      str << node.to_s()
    }
  end
  return str
end