Class: Hiq::Haiku
Overview
Haiku generating object
Instance Attribute Summary collapse
-
#words ⇒ Object
readonly
Returns the value of attribute words.
Instance Method Summary collapse
-
#initialize(words) ⇒ Haiku
constructor
A new instance of Haiku.
- #to_s ⇒ Object
Methods included from Syllabizable
#diphtongs, #silent_e_count, #syllables, #triphtongs
Constructor Details
#initialize(words) ⇒ Haiku
Returns a new instance of Haiku.
10 11 12 |
# File 'lib/hiq/haiku.rb', line 10 def initialize(words) @words = words.sort_by(&:size) end |
Instance Attribute Details
#words ⇒ Object (readonly)
Returns the value of attribute words.
8 9 10 |
# File 'lib/hiq/haiku.rb', line 8 def words @words end |
Instance Method Details
#to_s ⇒ Object
14 15 16 |
# File 'lib/hiq/haiku.rb', line 14 def to_s haiku_lines.map { |l| l.join(' ') }.join("\n") end |