Module: Hamlit::StringSplitter

Defined in:
lib/hamlit/string_splitter.rb

Class Method Summary collapse

Class Method Details

.compile(code) ⇒ Object

`code` param must be valid string literal


7
8
9
10
11
12
13
14
15
16
17
# File 'lib/hamlit/string_splitter.rb', line 7

def self.compile(code)
  unless Ripper.respond_to?(:lex) # truffleruby doesn't have Ripper.lex
    return [[:dynamic, code]]
  end

  begin
    Temple::Filters::StringSplitter.compile(code)
  rescue Temple::FilterError => e
    raise Hamlit::InternalError.new(e.message)
  end
end