Class: Peddler::Errors::ClassGenerator Private

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/peddler/errors/class_generator.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClassGenerator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ClassGenerator.



16
17
18
# File 'lib/peddler/errors/class_generator.rb', line 16

def initialize
  @mutex = Mutex.new
end

Class Method Details

.call(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/peddler/errors/class_generator.rb', line 12

def self.call(name)
  instance.generate(name)
end

Instance Method Details

#generate(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
# File 'lib/peddler/errors/class_generator.rb', line 20

def generate(name)
  with_mutex do
    return Errors.const_get(name) if Errors.const_defined?(name)
    Errors.const_set(name, Class.new(Error))
  end
end