Exception: Teapot::AlreadyDefinedError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/teapot/select.rb

Overview

Raised when a definition is already defined.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition, previous) ⇒ AlreadyDefinedError

Returns a new instance of AlreadyDefinedError.



18
19
20
# File 'lib/teapot/select.rb', line 18

def initialize(definition, previous)
	super "Definition #{definition.name} in #{definition.path} has already been defined in #{previous.path}!"
end

Class Method Details

.check(definition, definitions) ⇒ Object

Check if a definition would cause a conflict.

Raises:

  • (self)


25
26
27
28
29
# File 'lib/teapot/select.rb', line 25

def self.check(definition, definitions)
	previous = definitions[definition.name]
	
	raise self.new(definition, previous) if previous
end