Class: PoolParty::PoolPartyError

Inherits:
Object
  • Object
show all
Defined in:
lib/poolparty/pool_party_error.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) create(class_name = "StandardError", msg = "Error")

Create an error with the class_name and error message If the StandardError is not yet defined, define it, subclassing StandardError and return the new class Note: the class is set on Object



13
14
15
16
# File 'lib/poolparty/pool_party_error.rb', line 13

def self.create(class_name="StandardError", msg="Error")
  Object.const_set(class_name, Class.new(StandardError)) unless Object.const_defined?(class_name)
  class_name.constantize.send(:new, msg)
end