Module: Erubis::Converter
- Included in:
- Basic::Converter, PI::Converter
- Defined in:
- lib/erubis/converter.rb
Overview
convert
Instance Attribute Summary collapse
-
#escape ⇒ Object
Returns the value of attribute escape.
-
#postamble ⇒ Object
Returns the value of attribute postamble.
-
#preamble ⇒ Object
Returns the value of attribute preamble.
Class Method Summary collapse
-
.supported_properties ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#convert(input) ⇒ Object
convert input string into target language.
- #init_converter(properties = {}) ⇒ Object
Instance Attribute Details
#escape ⇒ Object
Returns the value of attribute escape.
16 17 18 |
# File 'lib/erubis/converter.rb', line 16 def escape @escape end |
#postamble ⇒ Object
Returns the value of attribute postamble.
16 17 18 |
# File 'lib/erubis/converter.rb', line 16 def postamble @postamble end |
#preamble ⇒ Object
Returns the value of attribute preamble.
16 17 18 |
# File 'lib/erubis/converter.rb', line 16 def preamble @preamble end |
Class Method Details
.supported_properties ⇒ Object
:nodoc:
18 19 20 21 22 23 24 |
# File 'lib/erubis/converter.rb', line 18 def self.supported_properties # :nodoc: return [ [:preamble, nil, "preamble (no preamble when false)"], [:postamble, nil, "postamble (no postamble when false)"], [:escape, nil, "escape expression or not in default"], ] end |
Instance Method Details
#convert(input) ⇒ Object
convert input string into target language
33 34 35 36 37 38 39 40 |
# File 'lib/erubis/converter.rb', line 33 def convert(input) codebuf = "" # or [] @preamble.nil? ? add_preamble(codebuf) : (@preamble && (codebuf << @preamble)) convert_input(codebuf, input) @postamble.nil? ? add_postamble(codebuf) : (@postamble && (codebuf << @postamble)) @_proc = nil # clear cached proc object return codebuf # or codebuf.join() end |
#init_converter(properties = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/erubis/converter.rb', line 26 def init_converter(properties={}) @preamble = properties[:preamble] @postamble = properties[:postamble] @escape = properties[:escape] end |