Exception: Alda::GenerationError
- Inherits:
-
StandardError
- Object
- StandardError
- Alda::GenerationError
- Defined in:
- lib/alda-rb/error.rb
Overview
Instance Attribute Summary collapse
-
#fine_generations ⇒ Object
readonly
The generations that could have been set to avoid the error.
-
#generation ⇒ Object
readonly
The actual generation that was set by Alda::generation when the error occurs.
Class Method Summary collapse
-
.assert_generation(fine_generations) ⇒ Object
Raises an Alda::GenerationError if the current generation is not in
fine_generations
.
Instance Method Summary collapse
-
#initialize(fine_generations) ⇒ GenerationError
constructor
:call-seq: new(fine_generations) -> Alda::GenerationError.
Constructor Details
#initialize(fine_generations) ⇒ GenerationError
:call-seq:
new(fine_generations) -> Alda::GenerationError
Creates a Alda::GenerationError object.
109 110 111 112 113 |
# File 'lib/alda-rb/error.rb', line 109 def initialize fine_generations super "bad Alda generation for this action; good ones are #{fine_generations}" @generation = Alda.generation @fine_generations = fine_generations end |
Instance Attribute Details
#fine_generations ⇒ Object (readonly)
The generations that could have been set to avoid the error. An Array.
102 103 104 |
# File 'lib/alda-rb/error.rb', line 102 def fine_generations @fine_generations end |
#generation ⇒ Object (readonly)
The actual generation that was set by Alda::generation when the error occurs.
97 98 99 |
# File 'lib/alda-rb/error.rb', line 97 def generation @generation end |
Class Method Details
.assert_generation(fine_generations) ⇒ Object
Raises an Alda::GenerationError if the current generation is not in fine_generations
.
117 118 119 |
# File 'lib/alda-rb/error.rb', line 117 def self.assert_generation fine_generations raise new fine_generations unless fine_generations.include? Alda.generation end |