Sha256: c0e6222c5028312c5608e6803d97d3379315e598657915c0053a5f0078f7f307
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
module Stitch class Compiler class << self def compilers @compilers ||= [] end def inherited(child) Compiler.compilers.unshift(child) end def all Compiler.compilers.select {|c| c.enabled? } end def source_extensions compilers = all.select {|c| c.source? } compilers.map {|c| c.extensions }.flatten end def for_extension(extension) extension.gsub!(/^\./, "") all.find do |item| item.extensions.include?(extension) end end # Child methods def extensions(*exts) @extensions ||= [] @extensions |= exts.map(&:to_s) end def enabled(value) @enabled = value end def enabled? @enabled != false end def source(value) @source = value end def source? @source || false end def compile(*args) self.new.compile(*args) end end def compile(filename) raise "Re-implement" end end end # Require default compilers require "stitch/compilers/javascript" require "stitch/compilers/coffeescript" require "stitch/compilers/tmpl" require "stitch/compilers/mustache"
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stitch-rb-0.0.7 | lib/stitch/compiler.rb |
stitch-rb-0.0.6 | lib/stitch/compiler.rb |