Class: Ree::ErrorDsl

Inherits:
Object show all
Defined in:
lib/ree/dsl/error_dsl.rb

Defined Under Namespace

Classes: ClassConstant

Instance Method Summary collapse

Instance Method Details

#execute(klass, &proc) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/ree/dsl/error_dsl.rb', line 4

def execute(klass, &proc)
  self.class.instance_exec(&proc)
rescue NameError => e
  proc
    .binding
    .eval("#{e.name} = Ree::ErrorDsl::ClassConstant.new('#{e.name}')")

  retry
end