Class: DbAgile::Core::Schema::Logical::Heading

Inherits:
Composite show all
Defined in:
lib/dbagile/core/schema/logical/heading.rb

Instance Attribute Summary

Attributes inherited from SchemaObject

#parent, #status

Instance Method Summary collapse

Methods inherited from Composite

#[], #[]=, #dependencies, #dup, #each_part, #empty?, #initialize, #look_same_as?, #part_keys, #parts, #size, #to_yaml, #visit, #yaml_display

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::Composite

Instance Method Details

#_semantics_check(clazz, buffer) ⇒ Object



32
33
34
35
36
37
# File 'lib/dbagile/core/schema/logical/heading.rb', line 32

def _semantics_check(clazz, buffer)
  if empty?
    buffer.add_error(self, clazz::UnsupportedEmptyHeading)
  end
  super(clazz, buffer)
end

#domain_of(attr_name) ⇒ Object

Returns the domain of a specific attribute



22
23
24
25
# File 'lib/dbagile/core/schema/logical/heading.rb', line 22

def domain_of(attr_name)
  attribute = self[attr_name]
  attribute ? attribute.domain : nil
end

#each_attribute(&block) ⇒ Object

Yields the block with each attribute



10
11
12
# File 'lib/dbagile/core/schema/logical/heading.rb', line 10

def each_attribute(&block)
  attributes.each(&block)
end

#has_attributes?(names) ⇒ Boolean

Checks if this heading has some attributes (through names)

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/dbagile/core/schema/logical/heading.rb', line 16

def has_attributes?(names)
  parts = composite_parts
  names.all?{|k| parts.key?(k)}
end

#to_sObject



39
40
41
# File 'lib/dbagile/core/schema/logical/heading.rb', line 39

def to_s
  "Heading of #{relation_variable.name}"
end