compile/core.rb
# Compiles an ERB template using the data from a key-value pair.
# The key-value pair may be a Hash or a Binding
Compiles an ERB template using the data from a key-value pair.
The key-value pair may be a Hash or a Binding
Compiles an ERB template using the data from a key - value pair . The key - value pair may be a Hash or a Binding
def compile_string(ctx, source)
      if ctx.is_a? Binding
        ERB.new(source, nil, '-%>').result(ctx).split("\n")
      elsif ctx.is_a? Hash
        ERB.new(source, nil, '-%>').result(
          OpenStruct.new(ctx).instance_eval { binding }
        ).split("\n")
      else
        raise TypeError, "#{ctx.class} is not a valid type for compilation"
      end
    end
def compile_string ( ctx , source ) if ctx . is_a? Binding ERB . new ( source , nil , '-%>' ) . result ( ctx ) . split ( "\n" ) elsif ctx . is_a? Hash ERB . new ( source , nil , '-%>' ) . result ( OpenStruct . new ( ctx ) . instance_eval { binding } ) . split ( "\n" ) else raise TypeError , "#{ctx.class} is not a valid type for compilation" end end
Compiles an ERB template using the data from a key-value pair.
Compiles an ERB template using the data from a key - value pair .
ctx
<not_specific>
source
<not_specific>