Sha256: abf4d3a4b92de2736efdbdc8b9def6132504b49b04ca34bf266636d705a98900

Contents?: true

Size: 808 Bytes

Versions: 2

Compression:

Stored size: 808 Bytes

Contents

require 'verbs'

module Resonance
  module Supports
    module Converter
      private

      def classify(str)
        str.camelize.constantize
      end

      def pluralize(str)
        str.pluralize
      end

      def progressize(str)
        if patches['progressize'].key?(str)
          return patches['progressize'][str]
        end

        str.verb.conjugate(aspect: :progressive).split(' ').last
      end

      def peoplize(str)
        str = (str.last == 'e') ? str.chop : str
        str + 'ers'
      end

      def pastize(str)
        str.verb.conjugate(tense: :past).split(' ').last
      end

      def patches
        @patches ||= YAML.load_file(patches_path)['patches']
      end

      def patches_path
        File.expand_path('../patches.yml', __FILE__)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resonance-0.4.0 lib/resonance/supports/converter.rb
resonance-0.3.3 lib/resonance/supports/converter.rb