Exception: Alda::GenerationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/alda-rb/error.rb

Overview

This error is raised when one tries to run commands that are not available for the generation of Alda specified by Alda::generation.

Alda.v1!
Alda.import # (GenerationError)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_generationsObject (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

#generationObject (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