class Rehab::Interpolation

inline like: {{ foo }}

Public Instance Methods

on_rehab_interpolate(string) click to toggle source
# File lib/rehab/interpolation.rb, line 5
def on_rehab_interpolate(string)
        block = [:multi]
        begin
                case string
                when /\{\{/m
                        block << [:static, $`]
                        exp, string = parse_expression $'
                        block << [:dynamic, exp]
                else
                        block << [:static, string]
                        string = ""
                end
        end until string.empty?
        block
end

Private Instance Methods

parse_expression(string) click to toggle source
# File lib/rehab/interpolation.rb, line 24
def parse_expression(string)
        /\}\}/m.match(string)
        [$`, $']
end