Module: Spectre::Delegate
Overview
Extension methods used by Spectre modules to expose registered methods in all Spectre and module scopes.
Constant Summary
collapse
- @@methods =
{}
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
109
110
111
112
113
114
|
# File 'lib/spectre.rb', line 109
def method_missing(method, *, &)
return @engine.send(method, *, &) if @engine.respond_to?(method)
return @outer_scope.send(method, *, &) if @outer_scope.respond_to?(method)
super
end
|
Instance Method Details
#instance_eval(&block) ⇒ Object
94
95
96
97
|
# File 'lib/spectre.rb', line 94
def instance_eval &block
@outer_scope = eval('self', block.binding)
super
end
|
#instance_exec(&block) ⇒ Object
99
100
101
102
|
# File 'lib/spectre.rb', line 99
def instance_exec(*, **, &block)
@outer_scope = eval('self', block.binding)
super
end
|
#respond_to_missing?(method) ⇒ Boolean
104
105
106
107
|
# File 'lib/spectre.rb', line 104
def respond_to_missing?(method, *)
@engine.respond_to?(method) or
@outer_scope.respond_to?(method)
end
|