Sha256: 0a08d90d1f6a0f49d6075d2f8c195985cdfe8c857dccd96524ed064be87820a7

Contents?: true

Size: 490 Bytes

Versions: 1

Compression:

Stored size: 490 Bytes

Contents

module Bunch
  class CoffeeNode
    def initialize(fn)
      require 'coffee-script'
      @filename = fn
    rescue LoadError
      $stderr.puts "ERROR: 'gem install coffee-script' to compile .coffee files."
    end

    def contents
      @contents ||= CoffeeScript.compile(File.read(@filename), :bare => false)
    end

    def name
      File.basename(@filename, '.coffee')
    end

    def target_extension
      'js'
    end

    def inspect
      @filename.inspect
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bunch-0.0.1 lib/bunch/coffee_node.rb