Class: Fop::Program
- Inherits:
-
Object
- Object
- Fop::Program
- Defined in:
- lib/fop/program.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Instance Method Summary collapse
- #apply(input) ⇒ Object
-
#initialize(src) ⇒ Program
constructor
A new instance of Program.
Constructor Details
Instance Attribute Details
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
6 7 8 |
# File 'lib/fop/program.rb', line 6 def nodes @nodes end |
Instance Method Details
#apply(input) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fop/program.rb', line 13 def apply(input) input = input.clone output = @nodes.reduce("") { |acc, token| section = token.consume!(input) return nil if section.nil? acc + section.to_s } input.empty? ? output : nil end |