Class: SimpleFeed::Key::TextTemplate
- Inherits:
-
Struct
- Object
- Struct
- SimpleFeed::Key::TextTemplate
- Defined in:
- lib/simplefeed/key/template.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text
7 8 9 |
# File 'lib/simplefeed/key/template.rb', line 7 def text @text end |
Instance Method Details
#render(params = {}) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/simplefeed/key/template.rb', line 8 def render(params = {}) output = self.text.dup params.each_pair do |key, value| output.gsub!(%r[{{\s*#{key}\s*}}], value.to_s) end output end |