Class: DbAgile::Core::Schema::Part
- Inherits:
-
SchemaObject
- Object
- SchemaObject
- DbAgile::Core::Schema::Part
- Defined in:
- lib/dbagile/core/schema/part.rb
Direct Known Subclasses
Logical::Attribute, Logical::Constraint, Logical::Relview, DbAgile::Core::Schema::Physical::Index
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Object definition.
-
#name ⇒ Object
readonly
Object name.
Attributes inherited from SchemaObject
Instance Method Summary collapse
-
#_sanity_check(schema) ⇒ Object
Makes a sanity check on the part.
-
#_semantics_check(clazz, buffer) ⇒ Object
Checks this composite’s semantics and collect errors.
-
#dependencies(include_parent = false) ⇒ Object
Returns an array with part dependencies.
-
#dup ⇒ Object
Duplicates this part.
-
#initialize(name, definition) ⇒ Part
constructor
Creates a part instance.
-
#look_same_as?(other) ⇒ Boolean
Compares with another part.
-
#to_s ⇒ Object
Returns a string representation.
- #visit(&block) ⇒ Object
Methods inherited from SchemaObject
#ancestors, #attribute?, #builder_args, #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, definition) ⇒ Part
Creates a part instance
13 14 15 16 |
# File 'lib/dbagile/core/schema/part.rb', line 13 def initialize(name, definition) @name = name @definition = definition end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Object definition
10 11 12 |
# File 'lib/dbagile/core/schema/part.rb', line 10 def definition @definition end |
#name ⇒ Object (readonly)
Object name
7 8 9 |
# File 'lib/dbagile/core/schema/part.rb', line 7 def name @name end |
Instance Method Details
#_sanity_check(schema) ⇒ Object
Makes a sanity check on the part
19 20 21 22 |
# File 'lib/dbagile/core/schema/part.rb', line 19 def _sanity_check(schema) raise SchemaInternalError, "No name provided on #{self}" if name.nil? raise SchemaInternalError, "No definition provided on #{self}" if definition.nil? end |
#_semantics_check(clazz, buffer) ⇒ Object
Checks this composite’s semantics and collect errors
25 26 |
# File 'lib/dbagile/core/schema/part.rb', line 25 def _semantics_check(clazz, buffer) end |
#dependencies(include_parent = false) ⇒ Object
Returns an array with part dependencies
33 34 35 |
# File 'lib/dbagile/core/schema/part.rb', line 33 def dependencies(include_parent = false) include_parent ? [ parent ] : [] end |
#dup ⇒ Object
Duplicates this part
53 54 55 |
# File 'lib/dbagile/core/schema/part.rb', line 53 def dup self.class.new(name, definition.dup) end |
#look_same_as?(other) ⇒ Boolean
Compares with another part
47 48 49 50 |
# File 'lib/dbagile/core/schema/part.rb', line 47 def look_same_as?(other) return nil unless other.kind_of?(self.class) (name == other.name) and (definition == other.definition) end |
#to_s ⇒ Object
Returns a string representation
58 59 60 |
# File 'lib/dbagile/core/schema/part.rb', line 58 def to_s "#{DbAgile::RubyTools::unqualified_class_name(self.class)}: #{name} #{definition.inspect}" end |
#visit(&block) ⇒ Object
38 39 40 |
# File 'lib/dbagile/core/schema/part.rb', line 38 def visit(&block) block.call(self, parent) end |