Class: Moxml::NativeAttachment::Opal

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/native_attachment/opal.rb

Overview

Opal adapter nodes are Ruby objects, so instance variables are sufficient for Moxml-owned attachments without relying on Monitor/Thread support.

Instance Method Summary collapse

Instance Method Details

#delete(native, key) ⇒ Object



20
21
22
23
24
25
# File 'lib/moxml/native_attachment/opal.rb', line 20

def delete(native, key)
  ivar_name = attachment_ivar_name(key)
  return unless native.instance_variable_defined?(ivar_name)

  native.remove_instance_variable(ivar_name)
end

#get(native, key) ⇒ Object



8
9
10
# File 'lib/moxml/native_attachment/opal.rb', line 8

def get(native, key)
  native.instance_variable_get(attachment_ivar_name(key))
end

#key?(native, key) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/moxml/native_attachment/opal.rb', line 16

def key?(native, key)
  native.instance_variable_defined?(attachment_ivar_name(key))
end

#set(native, key, value) ⇒ Object



12
13
14
# File 'lib/moxml/native_attachment/opal.rb', line 12

def set(native, key, value)
  native.instance_variable_set(attachment_ivar_name(key), value)
end