Module: Opal::Slim
- Defined in:
- lib/opal/slim.rb,
lib/opal/slim/version.rb
Defined Under Namespace
Classes: Processor, SlimProcessor
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.compile(source, file = '(slim)') ⇒ Object
20
21
22
|
# File 'lib/opal/slim.rb', line 20
def self.compile source, file='(slim)'
Opal.compile(wrap(compiled_slim(source), file))
end
|
.compiled_slim(source) ⇒ Object
7
8
9
10
|
# File 'lib/opal/slim.rb', line 7
def self.compiled_slim source
engine = ::Slim::Engine.new
engine.call(source).gsub(/(slim_controls\w+) <</, '\1 +=')
end
|
.wrap(compiled, file) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/opal/slim.rb', line 12
def self.wrap compiled, file
<<-EOF
Template.new('#{file}') do |slim|
#{compiled}
end
EOF
end
|