Class: MovableErb::Erb
- Inherits:
-
Object
- Object
- MovableErb::Erb
- Defined in:
- lib/movable_erb.rb
Overview
Convenience class to setup and parse data with an ERB template.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#parsed_string ⇒ Object
Returns the value of attribute parsed_string.
-
#template ⇒ Object
Returns the value of attribute template.
Class Method Summary collapse
-
.setup {|erb| ... } ⇒ MovableErb::Erb
Creates a new instance and allow manipulation of it via block.
Instance Method Summary collapse
-
#build! ⇒ String
Using the specified template, this will parse the template.
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
90 91 92 |
# File 'lib/movable_erb.rb', line 90 def data @data end |
#parsed_string ⇒ Object
Returns the value of attribute parsed_string.
90 91 92 |
# File 'lib/movable_erb.rb', line 90 def parsed_string @parsed_string end |
#template ⇒ Object
Returns the value of attribute template.
90 91 92 |
# File 'lib/movable_erb.rb', line 90 def template @template end |
Class Method Details
.setup {|erb| ... } ⇒ MovableErb::Erb
Creates a new instance and allow manipulation of it via block.
This can be used to initialize and parse quickly.
106 107 108 109 110 |
# File 'lib/movable_erb.rb', line 106 def self.setup erb = self.new yield erb erb end |
Instance Method Details
#build! ⇒ String
Using the specified template, this will parse the template
124 125 126 127 |
# File 'lib/movable_erb.rb', line 124 def build! erb = ERB.new(template, nil, '<>') @parsed_string = erb.result(binding) if erb end |