Class: Dommy::Bridge::ConstructorRegistry
- Inherits:
-
Object
- Object
- Dommy::Bridge::ConstructorRegistry
- Defined in:
- lib/dommy/bridge/constructor_registry.rb
Overview
Maps JS global constructor names (e.g. “Event”, “URL”, “XMLHttpRequest”) to their ‘Bridge::Constructor` instances. Window builds one and routes `js_get` name lookups through it, instead of carrying one ivar plus one `when` arm per constructor.
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize(map) ⇒ ConstructorRegistry
constructor
A new instance of ConstructorRegistry.
- #key?(name) ⇒ Boolean
-
#names ⇒ Object
The set of constructor names, e.g.
Constructor Details
#initialize(map) ⇒ ConstructorRegistry
Returns a new instance of ConstructorRegistry.
10 11 12 |
# File 'lib/dommy/bridge/constructor_registry.rb', line 10 def initialize(map) @map = map.freeze end |
Instance Method Details
#[](name) ⇒ Object
14 15 16 |
# File 'lib/dommy/bridge/constructor_registry.rb', line 14 def [](name) @map[name] end |
#key?(name) ⇒ Boolean
18 19 20 |
# File 'lib/dommy/bridge/constructor_registry.rb', line 18 def key?(name) @map.key?(name) end |
#names ⇒ Object
The set of constructor names, e.g. for host-side enumeration / tests.
23 24 25 |
# File 'lib/dommy/bridge/constructor_registry.rb', line 23 def names @map.keys end |