Class: Verbs::Verblike::Wrapper
- Inherits:
-
Object
- Object
- Verbs::Verblike::Wrapper
- Defined in:
- lib/verbs/verblike.rb
Instance Method Summary collapse
- #conjugate(options) ⇒ Object
-
#initialize(base) ⇒ Wrapper
constructor
A new instance of Wrapper.
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() words = @base.to_s.split words.shift if words.first.downcase == 'to' infinitive = words.shift.downcase.to_sym conjugation = ::Verbs::Conjugator.conjugate infinitive, conjugated = words.unshift(conjugation.to_s).join(' ') @base.is_a?(Symbol) ? conjugated.to_sym : conjugated end |