Class: Benchmark::Tms

Inherits:
Object show all
Includes:
Enumerable
Defined in:
lib/benchmark/nested/tms_ext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#childrenObject



11
12
13
# File 'lib/benchmark/nested/tms_ext.rb', line 11

def children
  @children ||= []
end

#labelObject

Returns the value of attribute label.



9
10
11
# File 'lib/benchmark/nested/tms_ext.rb', line 9

def label
  @label
end

Instance Method Details

#each(&block) ⇒ Object



15
16
17
# File 'lib/benchmark/nested/tms_ext.rb', line 15

def each(&block)
  children.each(&block)
end

#to_s(indent = 0) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/benchmark/nested/tms_ext.rb', line 19

def to_s(indent=0)
  lines = []
  lines << format(FMTSTR).rstrip
  indenter = ('>' * indent) + ' ' if indent > 0
  lines.last << " #{indenter}#{@label}"
  children.each do |child|
    lines << child.to_s(indent + 1)
  end
  lines.join("\n")
end