Module: Opal::Haml

Defined in:
lib/opal/haml.rb,
lib/opal/haml/version.rb,
lib/opal/haml/processor.rb

Defined Under Namespace

Classes: Processor

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.compile(source, file = '(haml)') ⇒ Object



7
8
9
10
# File 'lib/opal/haml.rb', line 7

def self.compile(source, file = '(haml)')
  haml = ::Haml::Engine.new(source, :ugly => true).precompiled
  Opal.compile(wrap(haml, file))
end

.wrap(haml, file) ⇒ Object



12
13
14
# File 'lib/opal/haml.rb', line 12

def self.wrap(haml, file)
  "Template.new('#{file}') do |_hamlout|\n#{haml}\n_hamlout.join\nend\n"
end