Class: DbAgile::Core::Schema::Physical::Index
- Inherits:
-
DbAgile::Core::Schema::Part
- Object
- SchemaObject
- DbAgile::Core::Schema::Part
- DbAgile::Core::Schema::Physical::Index
- Defined in:
- lib/dbagile/core/schema/physical/index.rb
Instance Attribute Summary
Attributes inherited from DbAgile::Core::Schema::Part
Attributes inherited from SchemaObject
Instance Method Summary collapse
- #_semantics_check(clazz, errors) ⇒ Object
- #dependencies(include_parent = false) ⇒ Object
-
#indexed_attributes ⇒ Object
Returns indexed attributes.
-
#indexed_relvar ⇒ Object
Relation variable targettet by this index.
-
#to_yaml(opts = {}) ⇒ Object
Delegation pattern on YAML flushing.
Methods inherited from DbAgile::Core::Schema::Part
#_sanity_check, #dup, #initialize, #look_same_as?, #to_s, #visit
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
This class inherits a constructor from DbAgile::Core::Schema::Part
Instance Method Details
#_semantics_check(clazz, errors) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dbagile/core/schema/physical/index.rb', line 33 def _semantics_check(clazz, errors) if (trv = indexed_relvar).nil? code = clazz::InvalidIndex | clazz::NoSuchRelvar errors.add_error(self, code, :relvar_name => definition[:relvar]) elsif !trv.heading.has_attributes?(definition[:attributes]) code = clazz::InvalidIndex | clazz::NoSuchRelvarAttributes errors.add_error(self, code, :relvar_name => trv.name, :attributes => definition[:attributes]) end end |
#dependencies(include_parent = false) ⇒ Object
22 23 24 25 26 |
# File 'lib/dbagile/core/schema/physical/index.rb', line 22 def dependencies(include_parent = false) deps = indexed_attributes deps += [ parent ] if include_parent deps end |
#indexed_attributes ⇒ Object
Returns indexed attributes
13 14 15 |
# File 'lib/dbagile/core/schema/physical/index.rb', line 13 def indexed_attributes definition[:attributes].collect{|k| indexed_relvar.heading[k]} end |
#indexed_relvar ⇒ Object
Relation variable targettet by this index
8 9 10 |
# File 'lib/dbagile/core/schema/physical/index.rb', line 8 def indexed_relvar schema.logical.relation_variable(definition[:relvar]) end |
#to_yaml(opts = {}) ⇒ Object
Delegation pattern on YAML flushing
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dbagile/core/schema/physical/index.rb', line 49 def to_yaml(opts = {}) YAML::quick_emit(self, opts){|out| defn = definition attrs = Schema::Builder::Coercion::unsymbolize_array(definition[:attributes]) out.map("tag:yaml.org,2002:map", :inline ) do |map| map.add('relvar', definition[:relvar].to_s) map.add('attributes', attrs) end } end |