Class: Hiq::FillerLibrary
- Inherits:
-
Object
- Object
- Hiq::FillerLibrary
- Defined in:
- lib/hiq/domain/filler_library.rb
Overview
Provided of filler for lines of haiku
Instance Attribute Summary collapse
-
#cfillers ⇒ Object
readonly
Returns the value of attribute cfillers.
-
#ifillers ⇒ Object
readonly
Returns the value of attribute ifillers.
Class Method Summary collapse
Instance Method Summary collapse
- #get_const_filler(filler_length) ⇒ Object
- #get_interpolated_filler(filler_length) ⇒ Object
-
#initialize ⇒ FillerLibrary
constructor
A new instance of FillerLibrary.
Constructor Details
#initialize ⇒ FillerLibrary
26 27 28 29 |
# File 'lib/hiq/domain/filler_library.rb', line 26 def initialize @ifillers = FillerLibrary.interpolated_fillers @cfillers = FillerLibrary.fillers end |
Instance Attribute Details
#cfillers ⇒ Object (readonly)
Returns the value of attribute cfillers.
24 25 26 |
# File 'lib/hiq/domain/filler_library.rb', line 24 def cfillers @cfillers end |
#ifillers ⇒ Object (readonly)
Returns the value of attribute ifillers.
24 25 26 |
# File 'lib/hiq/domain/filler_library.rb', line 24 def ifillers @ifillers end |
Class Method Details
.fillers ⇒ Object
17 18 19 20 21 22 |
# File 'lib/hiq/domain/filler_library.rb', line 17 def self.fillers { 5 => ['empty riverside', 'tears flow in the rain', 'cheerful summer\'s charm'], 7 => ['the vain wind of summer blows', 'gentle breeze upon a mountain', 'a frog jumps into a well'] } end |
.interpolated_fillers ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/hiq/domain/filler_library.rb', line 6 def self.interpolated_fillers { 1 => ['the X', 'a X'], 2 => ['ghastly X', 'the pale X'], 3 => ['shadow of X', 'X in silence'], 4 => ['X of my joy fade', 'X ends the autumn'], 5 => ['A spark of X above'], 6 => ['the sad facade of X torn'] } end |
Instance Method Details
#get_const_filler(filler_length) ⇒ Object
31 32 33 |
# File 'lib/hiq/domain/filler_library.rb', line 31 def get_const_filler(filler_length) cfillers[filler_length].delete(cfillers[filler_length].sample) end |
#get_interpolated_filler(filler_length) ⇒ Object
35 36 37 |
# File 'lib/hiq/domain/filler_library.rb', line 35 def get_interpolated_filler(filler_length) ifillers[filler_length].delete(ifillers[filler_length].sample) end |