Class: Mixml::Template::Text
Overview
Ruby string template
Instance Attribute Summary collapse
-
#text ⇒ String
readonly
Template text.
Instance Method Summary collapse
-
#evaluate(node) ⇒ Object
Evaulate the template using Ruby string interpolation.
-
#initialize(text) ⇒ Text
constructor
Initialize a new template.
Methods inherited from Base
Constructor Details
#initialize(text) ⇒ Text
Initialize a new template
13 14 15 16 17 |
# File 'lib/mixml/template/text.rb', line 13 def initialize(text) raise(ArgumentError, 'Text must not be nil.') if text.nil? @text = '"' << text.gsub('"', '\"') << '"' end |
Instance Attribute Details
#text ⇒ String (readonly)
Returns Template text.
8 9 10 |
# File 'lib/mixml/template/text.rb', line 8 def text @text end |
Instance Method Details
#evaluate(node) ⇒ Object
Evaulate the template using Ruby string interpolation
22 23 24 |
# File 'lib/mixml/template/text.rb', line 22 def evaluate(node) eval(@text, binding) end |