Class: CrystalRuby::Template::Renderer

Inherits:
Struct
  • Object
show all
Defined in:
lib/crystalruby/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#raw_valueObject

Returns the value of attribute raw_value

Returns:

  • (Object)

    the current value of raw_value



3
4
5
# File 'lib/crystalruby/template.rb', line 3

def raw_value
  @raw_value
end

Instance Method Details

#render(context) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/crystalruby/template.rb', line 5

def render(context)
  if context.kind_of?(::Hash)
    raw_value % context
  else
    ERB.new(raw_value, trim_mode: "%").result(context)
  end
end