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.
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() words = @base.to_s.split(' ') words.shift if words.first.downcase == 'to' infinitive = words.shift.to_sym conjugation = ::Verbs::Conjugator.conjugate infinitive, conjugated = words.unshift(conjugation.to_s).join(' ') @base.is_a?(Symbol) ? conjugated.to_sym : conjugated end |