Class: Rhymera::Portmanteau
- Inherits:
-
Object
- Object
- Rhymera::Portmanteau
- Defined in:
- lib/rhymera/portmanteau.rb
Overview
converts RhymeBrain json data to object
Instance Attribute Summary collapse
-
#alternative ⇒ Object
readonly
Returns the value of attribute alternative.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#suffix ⇒ Object
readonly
Returns the value of attribute suffix.
-
#word ⇒ Object
readonly
Returns the value of attribute word.
Instance Method Summary collapse
-
#initialize(source:, combined:) ⇒ Portmanteau
constructor
A new instance of Portmanteau.
Constructor Details
#initialize(source:, combined:) ⇒ Portmanteau
Returns a new instance of Portmanteau.
6 7 8 9 10 11 12 13 |
# File 'lib/rhymera/portmanteau.rb', line 6 def initialize(source:, combined:) source_words = source.split(',') combined_words = combined.split(',') @prefix = source_words[0] @suffix = source_words[1] @word = combined_words[0] @alternative = combined_words[1] if combined_words[1] end |
Instance Attribute Details
#alternative ⇒ Object (readonly)
Returns the value of attribute alternative.
4 5 6 |
# File 'lib/rhymera/portmanteau.rb', line 4 def alternative @alternative end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
4 5 6 |
# File 'lib/rhymera/portmanteau.rb', line 4 def prefix @prefix end |
#suffix ⇒ Object (readonly)
Returns the value of attribute suffix.
4 5 6 |
# File 'lib/rhymera/portmanteau.rb', line 4 def suffix @suffix end |
#word ⇒ Object (readonly)
Returns the value of attribute word.
4 5 6 |
# File 'lib/rhymera/portmanteau.rb', line 4 def word @word end |