Class: Kanrisuru::Template
- Inherits:
-
Object
- Object
- Kanrisuru::Template
- Defined in:
- lib/kanrisuru/template.rb
Instance Attribute Summary collapse
-
#trim_mode ⇒ Object
writeonly
Sets the attribute trim_mode.
Instance Method Summary collapse
-
#initialize(path, args = {}) ⇒ Template
constructor
A new instance of Template.
- #read ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(path, args = {}) ⇒ Template
Returns a new instance of Template.
9 10 11 12 13 14 15 16 |
# File 'lib/kanrisuru/template.rb', line 9 def initialize(path, args = {}) @path = path @trim_mode = '-' args.each do |variable_name, value| instance_variable_set("@#{variable_name}", value) end end |
Instance Attribute Details
#trim_mode=(value) ⇒ Object (writeonly)
Sets the attribute trim_mode
7 8 9 |
# File 'lib/kanrisuru/template.rb', line 7 def trim_mode=(value) @trim_mode = value end |
Instance Method Details
#read ⇒ Object
22 23 24 |
# File 'lib/kanrisuru/template.rb', line 22 def read StringIO.new(render) end |
#render ⇒ Object
18 19 20 |
# File 'lib/kanrisuru/template.rb', line 18 def render erb.result(binding) end |