Class: ROM::Schema::Definition::Relation
- Inherits:
-
Object
- Object
- ROM::Schema::Definition::Relation
- Defined in:
- lib/rom/schema/definition/relation.rb,
lib/rom/schema/definition/relation/base.rb
Overview
Builder object for Axiom relation
Direct Known Subclasses
Defined Under Namespace
Classes: Base
Instance Method Summary collapse
- #attribute(name, type) ⇒ Object private
- #call(name) ⇒ Object private
- #header ⇒ Object private
-
#initialize(&block) ⇒ Relation
constructor
private
A new instance of Relation.
- #key(*attribute_names) ⇒ Object private
Constructor Details
#initialize(&block) ⇒ Relation
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 Relation.
14 15 16 17 18 |
# File 'lib/rom/schema/definition/relation.rb', line 14 def initialize(&block) @header = [] @keys = [] instance_eval(&block) end |
Instance Method Details
#attribute(name, type) ⇒ Object
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.
31 32 33 |
# File 'lib/rom/schema/definition/relation.rb', line 31 def attribute(name, type) @header << [name, type] end |
#call(name) ⇒ Object
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.
21 22 23 |
# File 'lib/rom/schema/definition/relation.rb', line 21 def call(name) Axiom::Relation::Base.new(name, header) end |
#header ⇒ Object
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.
26 27 28 |
# File 'lib/rom/schema/definition/relation.rb', line 26 def header Axiom::Relation::Header.coerce(@header, keys: @keys) end |
#key(*attribute_names) ⇒ Object
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.
36 37 38 |
# File 'lib/rom/schema/definition/relation.rb', line 36 def key(*attribute_names) @keys.concat(attribute_names) end |