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.



4
5
6
# File 'lib/verbs/verblike.rb', line 4

def initialize(base)
  @base = base
end

Instance Method Details

#conjugate(options) ⇒ Object



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

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