Sha256: 128fe6f59b840ba52607707e07f4910f0b0d33c4627e9b9c3fc6ca9f913068be
Contents?: true
Size: 748 Bytes
Versions: 1
Compression:
Stored size: 748 Bytes
Contents
require 'singleton' module Codesake class Kernel include Singleton attr_reader :engine NONE = 0 TEXT = 1 JSP = 2 UNKNOWN = -1 def choose_engine(filename, options) engine = nil case detect(filename) when TEXT engine = Codesake::Engine::Text.new(filename) when NONE engine = Codesake::Engine::Generic.new(filename) when JSP engine = Codesake::Engine::Jsp.new(filename, options) end engine end def detect(filename) return NONE if filename.nil? or filename.empty? return TEXT if Codesake::Engine::Text.is_txt?(filename) return JSP if (File.extname(filename) == ".jsp") return UNKNOWN end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codesake-0.15.1 | lib/codesake/kernel.rb |