Sha256: ff7c9f618ba741ad8468681594617e0b4eeed5be97865e65cadc0f3eaf0e6716
Contents?: true
Size: 1.14 KB
Versions: 4
Compression:
Stored size: 1.14 KB
Contents
# coding: utf-8 ################################################ # © Alexander Semyonov, 2013—2013, MIT License # # Author: Alexander Semyonov <al@semyonov.us> # ################################################ require 'giteaucrat' module Giteaucrat module Formatters UnknownFormatError = Class.new(StandardError) EXTENSIONS = { '.rb' => :RubyFormatter, '.java' => :JavaFormatter, '.py' => :PythonFormatter, '.sass' => :SassFormatter, '.scss' => :SassFormatter, '.coffee' => :CoffeeFormatter, '.erl' => :ErlangFormatter, } module_function def formatter_for(file) extension = ::File.extname(file.name) formatter = EXTENSIONS[extension] raise(UnknownFormatError, extension) unless formatter const_get(formatter).new(file) end end end require 'giteaucrat/formatters/formatter' require 'giteaucrat/formatters/coffee_formatter' require 'giteaucrat/formatters/erlang_formatter' require 'giteaucrat/formatters/java_formatter' require 'giteaucrat/formatters/python_formatter' require 'giteaucrat/formatters/ruby_formatter' require 'giteaucrat/formatters/sass_formatter'
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
giteaucrat-0.0.7 | lib/giteaucrat/formatters.rb |
giteaucrat-0.0.6 | lib/giteaucrat/formatters.rb |
giteaucrat-0.0.5 | lib/giteaucrat/formatters.rb |
giteaucrat-0.0.4 | lib/giteaucrat/formatters.rb |