Sha256: cb98fe4d0663dfcdc1107ba045c8392bdd95b2bb511486854c29744e5b496b82

Contents?: true

Size: 674 Bytes

Versions: 10

Compression:

Stored size: 674 Bytes

Contents

module Howl
  class Converter < Plugin
    def self.converts(hash = nil)
      @converts ||= {}
      if hash
        @converts.merge!(hash)
      else
        @converts
      end
    end

    def self.matches?(ext)
      @converts.keys.any? do |matcher|
        matcher.match(ext)
      end
    end

    attr_accessor :extension

    def initialize(template)
      @template = template
      ext_regexp = self.class.converts.find { |conversion| conversion[0].match(@template.extension) }
      @extension = @template.extension.gsub(ext_regexp[0], ext_regexp[1])
    end

    def convert(text)
      text
    end

    priority :lowest
    converts /\..+$/ => '\0'
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
howl-0.6.0 lib/howl/converter.rb
howl-0.5.5 lib/howl/converter.rb
howl-0.5.4 lib/howl/converter.rb
howl-0.5.3 lib/howl/converter.rb
howl-0.5.2 lib/howl/converter.rb
howl-0.5.1 lib/howl/converter.rb
howl-0.5.0 lib/howl/converter.rb
howl-0.4.1 lib/howl/converter.rb
howl-0.4.0 lib/howl/converter.rb
howl-0.3.0 lib/howl/converter.rb