Module: Erubis::PI::Converter
Overview
Processing Instructions (PI) converter for XML. this class converts ‘<?rb … ?>’ and ‘$…’ notation.
Instance Attribute Summary collapse
-
#pi ⇒ Object
Returns the value of attribute pi.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
Attributes included from Converter
#escape, #postamble, #preamble
Class Method Summary collapse
-
.desc ⇒ Object
:nodoc:.
-
.supported_properties ⇒ Object
:nodoc:.
Instance Method Summary collapse
Instance Attribute Details
#pi ⇒ Object
Returns the value of attribute pi.
213 214 215 |
# File 'lib/erubis/converter.rb', line 213 def pi @pi end |
#prefix ⇒ Object
Returns the value of attribute prefix.
213 214 215 |
# File 'lib/erubis/converter.rb', line 213 def prefix @prefix end |
Class Method Details
.desc ⇒ Object
:nodoc:
200 201 202 |
# File 'lib/erubis/converter.rb', line 200 def self.desc # :nodoc: "use processing instructions (PI) instead of '<% %>'" end |
.supported_properties ⇒ Object
:nodoc:
204 205 206 207 208 209 210 211 |
# File 'lib/erubis/converter.rb', line 204 def self.supported_properties # :nodoc: return [ [:trim, true, "trim spaces around <% ... %>"], [:pi, 'rb', "PI (Processing Instrunctions) name"], [:embchar, '@', "char for embedded expression pattern('@{...}@')"], [:pattern, '<% %>', "embed pattern"], ] end |
Instance Method Details
#convert(input) ⇒ Object
224 225 226 227 |
# File 'lib/erubis/converter.rb', line 224 def convert(input) code = super(input) return @header || @footer ? "#{@header}#{code}#{@footer}" : code end |
#init_converter(properties = {}) ⇒ Object
215 216 217 218 219 220 221 222 |
# File 'lib/erubis/converter.rb', line 215 def init_converter(properties={}) super(properties) @trim = properties.fetch(:trim, true) @pi = properties[:pi] if properties[:pi] @embchar = properties[:embchar] || '@' @pattern = properties[:pattern] @pattern = '<% %>' if @pattern.nil? #|| @pattern == true end |