Class: Pslm::Psalm::Verse

Inherits:
Object
  • Object
show all
Defined in:
lib/pslm/psalm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flex = nil, first = nil, second = nil) ⇒ Verse

Returns a new instance of Verse.



60
61
62
63
64
65
66
67
# File 'lib/pslm/psalm.rb', line 60

def initialize(flex=nil, first=nil, second=nil)
  @flex = flex
  @first = first
  @second = second
  if second.nil? then
    yield self
  end
end

Instance Attribute Details

#firstObject

Returns the value of attribute first.



69
70
71
# File 'lib/pslm/psalm.rb', line 69

def first
  @first
end

#flexObject

Returns the value of attribute flex.



69
70
71
# File 'lib/pslm/psalm.rb', line 69

def flex
  @flex
end

#secondObject

Returns the value of attribute second.



69
70
71
# File 'lib/pslm/psalm.rb', line 69

def second
  @second
end

Instance Method Details

#==(v2) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/pslm/psalm.rb', line 77

def ==(v2)
  unless v2.is_a? Verse
    return false
  end

  [:flex, :first, :second].each do |part|
    if self.send(part) != v2.send(part) then
      return false
    end
  end

  return true
end

#partsObject



71
72
73
74
75
# File 'lib/pslm/psalm.rb', line 71

def parts
  r = [@first, @second]
  r.unshift @flex if @flex
  return r
end