Class: Cuporter::Node::Numbering::Numberer
- Inherits:
-
Object
- Object
- Cuporter::Node::Numbering::Numberer
- Defined in:
- lib/cuporter/node/numbering.rb
Instance Attribute Summary collapse
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize ⇒ Numberer
constructor
A new instance of Numberer.
- #number(node) ⇒ Object
Constructor Details
#initialize ⇒ Numberer
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
#total ⇒ Object (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 |