Sha256: 8a1f9382e8410a0dc9d023ff172c2943762960a389b08d5a56ccc2f6904d506b

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

module SlideHero
  class Code
    attr_reader :language, :source, :location
    def initialize(language, code_path=Dir.pwd, &code_file)
      @language = language
      @location = "#{code_path}/code/#{code_file.call}"
      @source = File.read(location)
    rescue Errno::ENOENT 
      abort "#{Dir.pwd}/#{code_file.call} not found"
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slide_hero-0.0.3 lib/slide_hero/code.rb