Class: ROM::Repository::StructBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/repository/struct_builder.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStructBuilder

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 StructBuilder.



15
16
17
# File 'lib/rom/repository/struct_builder.rb', line 15

def initialize
  @registry = self.class.registry
end

Instance Attribute Details

#registryObject (readonly)

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.



9
10
11
# File 'lib/rom/repository/struct_builder.rb', line 9

def registry
  @registry
end

Class Method Details

.registryObject

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.



11
12
13
# File 'lib/rom/repository/struct_builder.rb', line 11

def self.registry
  @__registry__ ||= {}
end

Instance Method Details

#call(*args) ⇒ Object Also known as: []

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.



19
20
21
22
23
24
# File 'lib/rom/repository/struct_builder.rb', line 19

def call(*args)
  name, columns = args
  registry[args.hash] ||= build_class(name) { |klass|
    klass.send(:include, Anima.new(*columns))
  }
end