Sha256: 39cef3d2386f73c2b3f8f726672efccdaeec70144bb90b21f6f280b29354f659

Contents?: true

Size: 737 Bytes

Versions: 13

Compression:

Stored size: 737 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

13 entries across 13 versions & 1 rubygems

Version Path
verbs-2.1.3 lib/verbs/verblike.rb
verbs-2.1.2 lib/verbs/verblike.rb
verbs-2.1.1 lib/verbs/verblike.rb
verbs-2.1.0 lib/verbs/verblike.rb
verbs-2.0.9 lib/verbs/verblike.rb
verbs-2.0.8 lib/verbs/verblike.rb
verbs-2.0.5 lib/verbs/verblike.rb
verbs-2.0.4 lib/verbs/verblike.rb
verbs-2.0.3 lib/verbs/verblike.rb
verbs-2.0.1 lib/verbs/verblike.rb
verbs-2.0.0 lib/verbs/verblike.rb
verbs-1.1.2 lib/verbs/verblike.rb
verbs-1.1.0 lib/verbs/verblike.rb