Sha256: 2aab2b01bafb83da1143b9a58191b369b34a691b78053e6d57431410f1dfe212

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

module Verbs
  module Verblike
    class Wrapper
      def initialize(base)
        @base = base
      end
      
      def conjugate(options)
        words = @base.to_s.split(' ')
        words.shift if words.first.downcase == 'to'
        infinitive = words.shift.to_sym
        conjugation = ::Verbs::Conjugator.conjugate infinitive, options
        conjugated = words.unshift(conjugation.to_s).join(' ')
        @base.is_a?(Symbol) ? conjugated.to_sym : conjugated
      end
    end
    
    module Access
      def verb
        ::Verbs::Verblike::Wrapper.new self
      end
    end
  end
end

class String
  include ::Verbs::Verblike::Access
end

class Symbol
  include ::Verbs::Verblike::Access
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
verbs-2.3.0 lib/verbs/verblike.rb
verbs-2.2.1 lib/verbs/verblike.rb
verbs-2.2.0 lib/verbs/verblike.rb
verbs-2.1.4 lib/verbs/verblike.rb
verbs-2.0.10 lib/verbs/verblike.rb