Class: Dphil::Verse
- Inherits:
-
Object
- Object
- Dphil::Verse
- Defined in:
- lib/dphil/verse.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#identify ⇒ Object
readonly
Returns the value of attribute identify.
-
#ms ⇒ Object
readonly
Returns the value of attribute ms.
-
#syllables ⇒ Object
readonly
Returns the value of attribute syllables.
-
#verse ⇒ Object
readonly
Returns the value of attribute verse.
-
#weights ⇒ Object
readonly
Returns the value of attribute weights.
Instance Method Summary collapse
-
#initialize(verse, ms: nil, id: nil) ⇒ Verse
constructor
A new instance of Verse.
- #to_json(options) ⇒ Object
Constructor Details
#initialize(verse, ms: nil, id: nil) ⇒ Verse
Returns a new instance of Verse.
8 9 10 11 12 13 14 |
# File 'lib/dphil/verse.rb', line 8 def initialize(verse, ms: nil, id: nil) @verse = verse.to_str.safe_copy @ms = ms.safe_copy @id = id.safe_copy @identify = VerseAnalysis.identify(@verse) deep_freeze end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/dphil/verse.rb', line 6 def id @id end |
#identify ⇒ Object (readonly)
Returns the value of attribute identify.
6 7 8 |
# File 'lib/dphil/verse.rb', line 6 def identify @identify end |
#ms ⇒ Object (readonly)
Returns the value of attribute ms.
6 7 8 |
# File 'lib/dphil/verse.rb', line 6 def ms @ms end |
#syllables ⇒ Object (readonly)
Returns the value of attribute syllables.
6 7 8 |
# File 'lib/dphil/verse.rb', line 6 def syllables @syllables end |
#verse ⇒ Object (readonly)
Returns the value of attribute verse.
6 7 8 |
# File 'lib/dphil/verse.rb', line 6 def verse @verse end |
#weights ⇒ Object (readonly)
Returns the value of attribute weights.
6 7 8 |
# File 'lib/dphil/verse.rb', line 6 def weights @weights end |
Instance Method Details
#to_json(options) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/dphil/verse.rb', line 16 def to_json() { ms: ms, id: id, verse: verse, syllables: syllables, weights: weights, identify: identify }.to_json() end |