Module: Erubis::PercentLineEnhancer

Includes:
PrefixedLineEnhancer
Included in:
PercentLineEruby
Defined in:
lib/erubis/enhancer.rb

Overview

regards lines starting with ‘%’ as program code

this is for compatibility to eruby and ERB.

this is language-independent.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PrefixedLineEnhancer

#init_generator

Class Method Details

.descObject

:nodoc:



504
505
506
# File 'lib/erubis/enhancer.rb', line 504

def self.desc   # :nodoc:
  "regard lines starting with '%' as program code"
end

Instance Method Details

#add_text(src, text) ⇒ Object

– def init_generator(properties={})

super
@prefixchar = '%'
@prefixrexp = /^\%(.*?\r?\n)/

end ++



516
517
518
519
520
521
522
# File 'lib/erubis/enhancer.rb', line 516

def add_text(src, text)
  unless @prefixrexp
    @prefixchar = '%'
    @prefixrexp = /^\%(.*?\r?\n)/
  end
  super(src, text)
end