Class: Dommy::Bridge::JSValue
- Inherits:
-
Object
- Object
- Dommy::Bridge::JSValue
- Defined in:
- lib/dommy/bridge.rb
Overview
An opaque handle to a JS-side value that Ruby only stores and hands back (an AbortSignal’s reason, a CustomEvent’s detail). A non-plain JS object (Error, class instance, …) crosses as one of these instead of being flattened to a Hash, so it round-trips with IDENTITY preserved. ‘to_s` exposes the captured JS string form for the rare Ruby consumer that needs text (e.g. building a message).
Instance Attribute Summary collapse
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
Instance Method Summary collapse
-
#initialize(ref, label = nil) ⇒ JSValue
constructor
A new instance of JSValue.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(ref, label = nil) ⇒ JSValue
Returns a new instance of JSValue.
49 50 51 52 |
# File 'lib/dommy/bridge.rb', line 49 def initialize(ref, label = nil) @ref = ref @label = label end |
Instance Attribute Details
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
47 48 49 |
# File 'lib/dommy/bridge.rb', line 47 def ref @ref end |
Instance Method Details
#inspect ⇒ Object
55 |
# File 'lib/dommy/bridge.rb', line 55 def inspect = "#<Dommy::Bridge::JSValue #{to_s}>" |
#to_s ⇒ Object
54 |
# File 'lib/dommy/bridge.rb', line 54 def to_s = (@label || "[object]").to_s |