Class: Dommy::Js::HostNodeFilter
- Inherits:
-
Object
- Object
- Dommy::Js::HostNodeFilter
- Defined in:
- lib/dommy/js/host_bridge.rb
Overview
A NodeFilter backed by a live JS object implementing the callback interface
({ acceptNode }). TreeWalker/NodeIterator treat it as the filter callable;
each invocation runs acceptNode on the JS object (this = object), and the
raising variant lets the filter's exception propagate out of the traversal.
Instance Attribute Summary collapse
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
Instance Method Summary collapse
- #__js_call__(_method, args) ⇒ Object
- #__js_call_with_raise__(args) ⇒ Object
-
#initialize(bridge, ref) ⇒ HostNodeFilter
constructor
A new instance of HostNodeFilter.
Constructor Details
#initialize(bridge, ref) ⇒ HostNodeFilter
Returns a new instance of HostNodeFilter.
524 525 526 527 |
# File 'lib/dommy/js/host_bridge.rb', line 524 def initialize(bridge, ref) @bridge = bridge @ref = ref end |
Instance Attribute Details
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
522 523 524 |
# File 'lib/dommy/js/host_bridge.rb', line 522 def ref @ref end |
Instance Method Details
#__js_call__(_method, args) ⇒ Object
529 530 531 |
# File 'lib/dommy/js/host_bridge.rb', line 529 def __js_call__(_method, args) @bridge.invoke_js_ref_accept_node(@ref, args[0]) end |
#__js_call_with_raise__(args) ⇒ Object
533 534 535 |
# File 'lib/dommy/js/host_bridge.rb', line 533 def __js_call_with_raise__(args) @bridge.invoke_js_ref_accept_node(@ref, args[0], raising: true) end |