Exception: Alda::OrderError
- Inherits:
-
StandardError
- Object
- StandardError
- Alda::OrderError
- Defined in:
- lib/alda-rb/error.rb
Overview
Instance Attribute Summary collapse
-
#expected ⇒ Object
readonly
The expected element gotten if it is of the correct order.
-
#got ⇒ Object
readonly
The actually gotten element.
Instance Method Summary collapse
-
#initialize(expected, got) ⇒ OrderError
constructor
:call-seq: new(expected, got) -> Alda::OrderError.
Constructor Details
#initialize(expected, got) ⇒ OrderError
:call-seq:
new(expected, got) -> Alda::OrderError
Creates a Alda::OrderError object.
159 160 161 162 163 |
# File 'lib/alda-rb/error.rb', line 159 def initialize expected, got super 'events are out of order' @expected = expected @got = got end |
Instance Attribute Details
#expected ⇒ Object (readonly)
The expected element gotten if it is of the correct order. See #got.
Alda::Score.new do
motif = f4 f e e d d c2
g4 f e d c2
p @events.size # => 2
c4 c g g a a g2 motif
rescue OrderError => e
p @events.size # => 1
p e.expected # => #<Alda::EventContainer:...>
p e.got # => #<Alda::EventContainer:...>
end
147 148 149 |
# File 'lib/alda-rb/error.rb', line 147 def expected @expected end |
#got ⇒ Object (readonly)
The actually gotten element. For an example, see #expected.
152 153 154 |
# File 'lib/alda-rb/error.rb', line 152 def got @got end |