Class: DbAgile::Core::Schema::Logical::Relvar
- Inherits:
-
Composite
- Object
- SchemaObject
- Composite
- DbAgile::Core::Schema::Logical::Relvar
- Defined in:
- lib/dbagile/core/schema/logical/relvar.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Relvar name.
Attributes inherited from SchemaObject
Instance Method Summary collapse
- #_install_eigenclass_methods? ⇒ Boolean
-
#_sanity_check(schema) ⇒ Object
Makes a sanity check on the part.
-
#_semantics_check(clazz, buffer) ⇒ Object
Checks this composite’s semantics and collects errors inside buffer.
-
#builder_args ⇒ Object
Returns the arguments to pass to builder handler.
-
#dup ⇒ Object
Duplicates this attribute.
-
#initialize(name, parts = _default_parts) ⇒ Relvar
constructor
Creates a relation variable instance.
-
#look_same_as?(other) ⇒ Boolean
Compares with another attribute.
-
#to_s ⇒ Object
Returns a string representation.
Methods inherited from Composite
#[], #[]=, #dependencies, #each_part, #empty?, #part_keys, #parts, #size, #to_yaml, #visit, #yaml_display
Methods inherited from SchemaObject
#ancestors, #attribute?, #builder_handler, #candidate_key?, #composite?, #constraint?, #foreign_key?, #index?, #logical?, #outside_dependencies, #outside_dependents, #part?, #physical?, #primary_key?, #relation_variable, #relvar?, #relview?, #schema
Constructor Details
#initialize(name, parts = _default_parts) ⇒ Relvar
Creates a relation variable instance
11 12 13 14 15 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 11 def initialize(name, parts = _default_parts) @name = name.to_s.to_sym super(parts) @insert_order = [ :heading, :constraints ] & parts.keys end |
Instance Attribute Details
#name ⇒ Object (readonly)
Relvar name
8 9 10 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 8 def name @name end |
Instance Method Details
#_install_eigenclass_methods? ⇒ Boolean
22 23 24 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 22 def _install_eigenclass_methods? true end |
#_sanity_check(schema) ⇒ Object
Makes a sanity check on the part
33 34 35 36 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 33 def _sanity_check(schema) raise SchemaInternalError, "No name provided on #{self}" if name.nil? super(schema) end |
#_semantics_check(clazz, buffer) ⇒ Object
Checks this composite’s semantics and collects errors inside buffer
39 40 41 42 43 44 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 39 def _semantics_check(clazz, buffer) if constraints.primary_key.nil? buffer.add_error(self, clazz::MissingPrimaryKey) end super(clazz, buffer) end |
#builder_args ⇒ Object
Returns the arguments to pass to builder handler
51 52 53 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 51 def builder_args [ name ] end |
#dup ⇒ Object
Duplicates this attribute
67 68 69 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 67 def dup Logical::Relvar.new(name, :heading => heading.dup, :constraints => constraints.dup) end |
#look_same_as?(other) ⇒ Boolean
Compares with another attribute
60 61 62 63 64 |
# File 'lib/dbagile/core/schema/logical/relvar.rb', line 60 def look_same_as?(other) return nil unless other.kind_of?(Relvar) return false unless name == other.name super(other) end |