Class: Fabulator::Grammar::Actions::When
- Inherits:
-
Structural
- Object
- Structural
- Fabulator::Grammar::Actions::When
- Defined in:
- lib/fabulator/grammar/actions/when.rb
Instance Method Summary collapse
Instance Method Details
#compile_xml(xml, ctx = nil) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/fabulator/grammar/actions/when.rb', line 13 def compile_xml(xml, ctx = nil) super parser = Fabulator::Grammar::RuleParser.new # parse @matches @c_matches = parser.parse(self.matches) end |
#parse(cursor) ⇒ Object
22 23 24 |
# File 'lib/fabulator/grammar/actions/when.rb', line 22 def parse(cursor) @c_matches.parse(cursor) end |
#score(context, data) ⇒ Object
26 27 28 29 |
# File 'lib/fabulator/grammar/actions/when.rb', line 26 def score(context, data) return 0 if @score.nil? (@score.run(context.with_root(context.root.roots['result'])).value rescue 0) end |