Class: Rehab::Interpolation

Inherits:
Filter
  • Object
show all
Defined in:
lib/rehab/interpolation.rb

Overview

inline like: foo }

Instance Method Summary collapse

Instance Method Details

#on_rehab_interpolate(string) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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