Class: DefinitionFilter
- Inherits:
-
Object
- Object
- DefinitionFilter
- Defined in:
- lib/notroff/embedded.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(def_re, include_body = true) ⇒ DefinitionFilter
constructor
A new instance of DefinitionFilter.
- #process(paras) ⇒ Object
Constructor Details
#initialize(def_re, include_body = true) ⇒ DefinitionFilter
Returns a new instance of DefinitionFilter.
34 35 36 37 |
# File 'lib/notroff/embedded.rb', line 34 def initialize(def_re, include_body=true) @def_re = def_re @include_body = include_body end |
Instance Method Details
#process(paras) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/notroff/embedded.rb', line 39 def process(paras) state = :before_def end_re = nil paras.each do |para| Logger.log para, (@def_re =~ para) if state == :before_def and @def_re =~ para para[:included] = true end_re = Regexp.new( "^#{' ' * para.string.indent_depth}end" ) state = :after_def elsif state == :after_def and end_re =~ para.string para[:included] = true break elsif state == :after_def and @include_body para[:included] = true end end paras end |