Module: Tracinho

Defined in:
lib/tracinho.rb,
lib/tracinho/word.rb,
lib/tracinho/version.rb,
lib/tracinho/word_classifier.rb,
lib/tracinho/complement_builder.rb

Overview

This gem converts words with dash in the version without it and vice-versa. It also gets the verb name from a word and gives the full grammar classification of the verb.

Defined Under Namespace

Classes: ComplementBuilder, Word, WordClassifier

Constant Summary collapse

VERSION =
'0.1.6'

Class Method Summary collapse

Class Method Details

.pair?(word1, word2) ⇒ Boolean Also known as: complementary?

Returns true if one word is the complement of the other.

w1 = Word.new('fizeste')
w2 = Word.new('fizes-te')

Tracinho.pair?(w1, w2)
# => true

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'lib/tracinho.rb', line 17

def self.pair?(word1, word2)
  word1 = Word.new(word1) unless word1.is_a?(Word)
  word2 = Word.new(word2) unless word2.is_a?(Word)

  word1.complement.to_s == word2.to_s
end