Class: Pslm::Psalm
- Inherits:
-
Object
- Object
- Pslm::Psalm
- Defined in:
- lib/pslm/psalm.rb
Defined Under Namespace
Classes: Strophe, Syllable, Verse, VersePart, Word
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#strophes ⇒ Object
readonly
Returns the value of attribute strophes.
Instance Method Summary collapse
-
#+(ps2) ⇒ Object
returns a new Psalm containing verses of the second appended to the verses of the first; everything else is copied from the first (title etc. of the second Psalm get lost).
- #==(ps2) ⇒ Object
- #add_strophe(s = nil) ⇒ Object
- #add_verse(v) ⇒ Object
-
#initialize ⇒ Psalm
constructor
A new instance of Psalm.
-
#verses ⇒ Object
accesses all verses of the psalm regardless of the strophes.
Constructor Details
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
15 16 17 |
# File 'lib/pslm/psalm.rb', line 15 def header @header end |
#strophes ⇒ Object (readonly)
Returns the value of attribute strophes.
15 16 17 |
# File 'lib/pslm/psalm.rb', line 15 def strophes @strophes end |
Instance Method Details
#+(ps2) ⇒ Object
returns a new Psalm containing verses of the second appended to the verses of the first; everything else is copied from the first (title etc. of the second Psalm get lost)
41 42 43 44 45 |
# File 'lib/pslm/psalm.rb', line 41 def +(ps2) ps_res = self.dup ps_res.strophes.concat ps2.strophes return ps_res end |
#==(ps2) ⇒ Object
34 35 36 |
# File 'lib/pslm/psalm.rb', line 34 def ==(ps2) ps2.is_a?(Psalm) && self.header == ps2.header && self.strophes == ps2.strophes end |
#add_strophe(s = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/pslm/psalm.rb', line 22 def add_strophe(s=nil) if s != nil then @strophes << s else @strophes << Strophe.new end end |
#add_verse(v) ⇒ Object
30 31 32 |
# File 'lib/pslm/psalm.rb', line 30 def add_verse(v) @strophes.last.verses << v end |
#verses ⇒ Object
accesses all verses of the psalm regardless of the strophes
18 19 20 |
# File 'lib/pslm/psalm.rb', line 18 def verses @strophes.collect {|s| s.verses }.flatten end |