Class: V8::Portal::Interceptors::Interceptor
- Defined in:
- lib/v8/portal/interceptors.rb
Direct Known Subclasses
IndexedPropertyDeleter, IndexedPropertyEnumerator, IndexedPropertyGetter, IndexedPropertyQuery, IndexedPropertySetter, NamedPropertyDeleter, NamedPropertyEnumerator, NamedPropertyGetter, NamedPropertySetter
Instance Method Summary collapse
-
#initialize(portal) ⇒ Interceptor
constructor
A new instance of Interceptor.
- #intercept(info, retval = nil, &code) ⇒ Object
Constructor Details
#initialize(portal) ⇒ Interceptor
Returns a new instance of Interceptor.
49 50 51 |
# File 'lib/v8/portal/interceptors.rb', line 49 def initialize(portal) @to, @access = portal, portal.access end |
Instance Method Details
#intercept(info, retval = nil, &code) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/v8/portal/interceptors.rb', line 53 def intercept(info, retval = nil, &code) obj = @to.rb(info.This()) intercepts = true result = @to.caller.protect do dontintercept = proc do intercepts = false end code.call(obj, dontintercept) end intercepts ? (retval || result) : C::Empty end |