Class: SlideHero::Code

Inherits:
Object
  • Object
show all
Defined in:
lib/slide_hero/code.rb

Instance Method Summary collapse

Constructor Details

#initialize(language, &code_file) ⇒ Code

Returns a new instance of Code.



3
4
5
6
7
8
# File 'lib/slide_hero/code.rb', line 3

def initialize(language, &code_file)
  @language = language
  @source = File.read("#{Dir.pwd}/#{code_file.call}")
rescue Errno::ENOENT 
  abort "#{Dir.pwd}/#{code_file.call} not found"
end

Instance Method Details

#compileObject



10
11
12
13
14
# File 'lib/slide_hero/code.rb', line 10

def compile
  Tilt::ERBTemplate.
    new(File.join(Gem.loaded_specs['slide_hero'].full_gem_path, 
                  'lib/slide_hero/views/code.html.erb')).render(self)
end