Class: Cuporter::Node::Numbering::Numberer

Inherits:
Object
  • Object
show all
Defined in:
lib/cuporter/node/numbering.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNumberer

Returns a new instance of Numberer.



9
10
11
# File 'lib/cuporter/node/numbering.rb', line 9

def initialize
  @total = 0
end

Instance Attribute Details

#totalObject (readonly)

Returns the value of attribute total.



7
8
9
# File 'lib/cuporter/node/numbering.rb', line 7

def total
  @total
end

Instance Method Details

#number(node) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/cuporter/node/numbering.rb', line 13

def number(node)
  node.children.each do |child|
    case child.node_name
    when 'scenario', 'example'
      child["number"] = (@total += 1).to_s
    end
    number(child)
  end
end