Module: Nashorn::Ruby::Scriptable
Overview
Shared “JSObject” implementation.
Instance Attribute Summary collapse
-
#unwrap ⇒ Object
readonly
Returns the value of attribute unwrap.
Instance Method Summary collapse
- #getMember(name) ⇒ Object
- #getSlot(name) ⇒ Object
- #hasMember(name) ⇒ Object
- #hasSlot(name) ⇒ Object
- #keySet ⇒ Object
- #removeMember(name) ⇒ Object
- #setMember(name, value) ⇒ Object
- #setSlot(name, value) ⇒ Object
Instance Attribute Details
#unwrap ⇒ Object (readonly)
Returns the value of attribute unwrap.
33 34 35 |
# File 'lib/nashorn/ruby.rb', line 33 def unwrap @unwrap end |
Instance Method Details
#getMember(name) ⇒ Object
36 37 38 39 |
# File 'lib/nashorn/ruby.rb', line 36 def getMember(name) return nil if exclude?(name) Ruby.access.get(unwrap, name) { super } end |
#getSlot(name) ⇒ Object
54 55 56 57 |
# File 'lib/nashorn/ruby.rb', line 54 def getSlot(name) return nil if exclude?(name) Ruby.access.get_slot(unwrap, name) { super } end |
#hasMember(name) ⇒ Object
42 43 44 45 |
# File 'lib/nashorn/ruby.rb', line 42 def hasMember(name) return nil if exclude?(name) Ruby.access.has(unwrap, name) { super } end |
#hasSlot(name) ⇒ Object
60 61 62 63 |
# File 'lib/nashorn/ruby.rb', line 60 def hasSlot(name) return nil if exclude?(name) Ruby.access.has_slot(unwrap, name) { super } end |
#keySet ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/nashorn/ruby.rb', line 77 def keySet ids = java.util.HashSet.new super_set = super unwrap.public_methods(false).each do |name| next unless name = convert(name.to_s) unless super_set.include?(name) ids.add name.to_java # java.lang.String end end ids end |
#removeMember(name) ⇒ Object
72 73 74 |
# File 'lib/nashorn/ruby.rb', line 72 def removeMember(name) setMember(name, nil) # TODO remove_method? end |