Class: HamlProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/reveal-ck/haml_processor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(haml) ⇒ HamlProcessor

Returns a new instance of HamlProcessor.



8
9
10
11
12
# File 'lib/reveal-ck/haml_processor.rb', line 8

def initialize(haml)
  render_context = ::OpenStruct.new({})
  engine = ::Haml::Engine.new haml
  @html = engine.render render_context
end

Instance Attribute Details

#htmlObject (readonly)

Returns the value of attribute html.



6
7
8
# File 'lib/reveal-ck/haml_processor.rb', line 6

def html
  @html
end

Class Method Details

.open(path) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/reveal-ck/haml_processor.rb', line 14

def self.open(path)
  haml_file = if File.exists? path
    path
  else
    File.expand_path(File.join(Dir.pwd, path))
  end
  haml = File.open(haml_file).read
  HamlProcessor.new haml
end