Class: Hiq::WordChecker

Inherits:
Object
  • Object
show all
Includes:
Syllabizable
Defined in:
lib/hiq/domain/word_checker.rb

Overview

service for checking whether haiku can be constructed out of those words

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Syllabizable

#diphtongs, #silent_e_count, #syllables, #triphtongs

Constructor Details

#initialize(words) ⇒ WordChecker

Returns a new instance of WordChecker.



14
15
16
# File 'lib/hiq/domain/word_checker.rb', line 14

def initialize(words)
  @words = words
end

Instance Attribute Details

#wordsObject (readonly)

Returns the value of attribute words.



8
9
10
# File 'lib/hiq/domain/word_checker.rb', line 8

def words
  @words
end

Class Method Details

.validate!(words) ⇒ Object



10
11
12
# File 'lib/hiq/domain/word_checker.rb', line 10

def self.validate!(words)
  new(words).validate!
end

Instance Method Details

#validate!Object



18
19
20
21
# File 'lib/hiq/domain/word_checker.rb', line 18

def validate!
  ensure_word_length
  ensure_word_composition
end