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.
60 61 62 63 |
# File 'lib/dommy/bridge.rb', line 60 def initialize(ref, label = nil) @ref = ref @label = label end |
Instance Attribute Details
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
58 59 60 |
# File 'lib/dommy/bridge.rb', line 58 def ref @ref end |
Instance Method Details
#inspect ⇒ Object
66 |
# File 'lib/dommy/bridge.rb', line 66 def inspect = "#<Dommy::Bridge::JSValue #{to_s}>" |
#to_s ⇒ Object
65 |
# File 'lib/dommy/bridge.rb', line 65 def to_s = (@label || "[object]").to_s |