Class: BetweenFilter
- Inherits:
-
Object
- Object
- BetweenFilter
- Defined in:
- lib/notroff/embedded.rb
Instance Method Summary collapse
-
#initialize(re1, re2 = re1) ⇒ BetweenFilter
constructor
A new instance of BetweenFilter.
- #process(paras) ⇒ Object
Constructor Details
#initialize(re1, re2 = re1) ⇒ BetweenFilter
Returns a new instance of BetweenFilter.
12 13 14 15 |
# File 'lib/notroff/embedded.rb', line 12 def initialize(re1, re2=re1) @re1 = re1 @re2 = re2 end |
Instance Method Details
#process(paras) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/notroff/embedded.rb', line 17 def process(paras) state = :before_first paras.each do |para| if state == :before_first and @re1 =~ para para[:included] = true state = :after_first break if para =~ @re2 elsif state == :after_first para[:included] = true break if para =~ @re2 end end paras end |