Class: ROM::Factory::Structs
- Inherits:
-
Object
- Object
- ROM::Factory::Structs
- Defined in:
- lib/rom/factory/factories.rb
Overview
In-memory builder API
Instance Attribute Summary collapse
- #registry ⇒ Object readonly
- #struct_namespace ⇒ Object readonly
Instance Method Summary collapse
-
#[](name, *traits, **attrs) ⇒ ROM::Struct
Build an in-memory struct.
-
#initialize(registry, struct_namespace) ⇒ Structs
constructor
private
A new instance of Structs.
Constructor Details
#initialize(registry, struct_namespace) ⇒ Structs
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Structs.
22 23 24 25 |
# File 'lib/rom/factory/factories.rb', line 22 def initialize(registry, struct_namespace) @registry = registry @struct_namespace = struct_namespace end |
Instance Attribute Details
#registry ⇒ Object (readonly)
15 16 17 |
# File 'lib/rom/factory/factories.rb', line 15 def registry @registry end |
#struct_namespace ⇒ Object (readonly)
19 20 21 |
# File 'lib/rom/factory/factories.rb', line 19 def struct_namespace @struct_namespace end |
Instance Method Details
#[](name, *traits, **attrs) ⇒ ROM::Struct
Build an in-memory struct
41 42 43 |
# File 'lib/rom/factory/factories.rb', line 41 def [](name, *traits, **attrs) registry[name].struct_namespace(struct_namespace).create(*traits, **attrs) end |