Class: Peddler::Errors::ClassGenerator Private
- Inherits:
-
Object
- Object
- Peddler::Errors::ClassGenerator
- 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
- .call(name) ⇒ Object private
Instance Method Summary collapse
- #generate(name) ⇒ Object private
-
#initialize ⇒ ClassGenerator
constructor
private
A new instance of ClassGenerator.
Constructor Details
#initialize ⇒ ClassGenerator
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 |