Class: Hiq::LineComposer
- Inherits:
-
Object
- Object
- Hiq::LineComposer
- Includes:
- Syllabizable
- Defined in:
- lib/hiq/domain/line_composer.rb
Overview
service responsible for composing a single line of Haiku
Instance Attribute Summary collapse
-
#library ⇒ Object
readonly
Returns the value of attribute library.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#target_syllable_length ⇒ Object
readonly
Returns the value of attribute target_syllable_length.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(line, target_syllable_length:, library:) ⇒ LineComposer
constructor
A new instance of LineComposer.
Methods included from Syllabizable
#diphtongs, #silent_e_count, #syllables, #triphtongs
Constructor Details
#initialize(line, target_syllable_length:, library:) ⇒ LineComposer
Returns a new instance of LineComposer.
14 15 16 17 18 |
# File 'lib/hiq/domain/line_composer.rb', line 14 def initialize(line, target_syllable_length:, library:) @line = line @target_syllable_length = target_syllable_length @library = library end |
Instance Attribute Details
#library ⇒ Object (readonly)
Returns the value of attribute library.
8 9 10 |
# File 'lib/hiq/domain/line_composer.rb', line 8 def library @library end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
8 9 10 |
# File 'lib/hiq/domain/line_composer.rb', line 8 def line @line end |
#target_syllable_length ⇒ Object (readonly)
Returns the value of attribute target_syllable_length.
8 9 10 |
# File 'lib/hiq/domain/line_composer.rb', line 8 def target_syllable_length @target_syllable_length end |
Class Method Details
.call(line, target_syllable_length:, library:) ⇒ Object
10 11 12 |
# File 'lib/hiq/domain/line_composer.rb', line 10 def self.call(line, target_syllable_length:, library:) new(line, target_syllable_length: target_syllable_length, library: library).call end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 |
# File 'lib/hiq/domain/line_composer.rb', line 20 def call return line if syllable_gap_size.zero? filled_line end |