Class: Verbs::Verblike::Wrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/verbs/verblike.rb

Instance Method Summary collapse

Constructor Details

#initialize(base) ⇒ Wrapper

Returns a new instance of Wrapper.



6
7
8
# File 'lib/verbs/verblike.rb', line 6

def initialize(base)
  @base = base
end

Instance Method Details

#conjugate(options) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/verbs/verblike.rb', line 10

def conjugate(options)
  words = @base.to_s.split
  words.shift if words.first.downcase == 'to'
  infinitive = words.shift.downcase.to_sym
  conjugation = ::Verbs::Conjugator.conjugate infinitive, options
  conjugated = words.unshift(conjugation.to_s).join(' ')
  @base.is_a?(Symbol) ? conjugated.to_sym : conjugated
end