Sha256: 4f0dde8bfe31add6979bc5fad945dc9d2f81fd098cc8164f3be70bd88255f4c8

Contents?: true

Size: 523 Bytes

Versions: 6

Compression:

Stored size: 523 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(SlideHero.template_path,
                      'lib/slide_hero/views/code.html.erb')).render(self)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
slide_hero-0.0.9 lib/slide_hero/code.rb
slide_hero-0.0.8 lib/slide_hero/code.rb
slide_hero-0.0.7 lib/slide_hero/code.rb
slide_hero-0.0.6 lib/slide_hero/code.rb
slide_hero-0.0.5 lib/slide_hero/code.rb
slide_hero-0.0.4 lib/slide_hero/code.rb