Class: Haikuable::Checker
- Inherits:
-
Object
- Object
- Haikuable::Checker
- Defined in:
- lib/haikuable.rb
Constant Summary collapse
- HAIKU_SYLLABLE_COUNT =
17
Instance Attribute Summary collapse
-
#line_counts ⇒ Object
Returns the value of attribute line_counts.
-
#string ⇒ Object
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string) ⇒ Checker
constructor
A new instance of Checker.
- #is_haiku? ⇒ Boolean
Constructor Details
Instance Attribute Details
#line_counts ⇒ Object
Returns the value of attribute line_counts.
6 7 8 |
# File 'lib/haikuable.rb', line 6 def line_counts @line_counts end |
#string ⇒ Object
Returns the value of attribute string.
6 7 8 |
# File 'lib/haikuable.rb', line 6 def string @string end |
Instance Method Details
#is_haiku? ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/haikuable.rb', line 15 def is_haiku? return false unless string_syllable_count == haiku_syllable_count individual_syllables.each do |syl_count| line_counts.each do |key, count| if line_counts[key] < haiku_lines[key] line_counts[key] += syl_count end end end line_counts == haiku_lines end |