Class: Zxc::SplitRegexp
- Inherits:
-
Step
- Object
- Step
- Zxc::SplitRegexp
show all
- Defined in:
- lib/zxc/steps/split_regexp.rb
Constant Summary
Constants inherited
from Step
Zxc::Step::Kind
Instance Method Summary
collapse
Methods inherited from Step
#depth_decreased, #depth_increased, #initialize
Constructor Details
This class inherits a constructor from Zxc::Step
Instance Method Details
#run(root) ⇒ Object
11
12
13
14
|
# File 'lib/zxc/steps/split_regexp.rb', line 11
def run(root)
root.leaves.each { |l| run_leaf(l) }
depth_increased(root)
end
|
#run_leaf(node) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/zxc/steps/split_regexp.rb', line 16
def run_leaf(node)
splitted = node.text.split(Regexp.new(@args[0]))
splitted.each do |t|
node.subnodes << Node.new(t, node)
end
end
|