Class: Spectre::DslClass

Inherits:
Object show all
Defined in:
lib/spectre.rb

Overview

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, **kwargs, &block) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/spectre.rb', line 69

def method_missing method, *args, **kwargs, &block
  if @__bound_self__.respond_to? method
    @__bound_self__.send(method, *args, **kwargs, &block)
  else
    Delegator.redirect(method, *args, **kwargs, &block)
  end
end

Instance Method Details

#_evaluate(&block) ⇒ Object



59
60
61
62
# File 'lib/spectre.rb', line 59

def _evaluate &block
  @__bound_self__ = eval('self', block.binding)
  instance_eval(&block)
end

#_execute(*args, &block) ⇒ Object



64
65
66
67
# File 'lib/spectre.rb', line 64

def _execute *args, &block
  @__bound_self__ = eval('self', block.binding)
  instance_exec(*args, &block)
end