Class: SchemaRD::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/schemard/schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSchema

Returns a new instance of Schema.



6
7
8
9
# File 'lib/schemard/schema.rb', line 6

def initialize
  @tables = {}
  @relations = []
end

Instance Attribute Details

#relationsObject (readonly)

Returns the value of attribute relations.



5
6
7
# File 'lib/schemard/schema.rb', line 5

def relations
  @relations
end

Instance Method Details

#add_relation(relation) ⇒ Object



20
21
22
# File 'lib/schemard/schema.rb', line 20

def add_relation(relation)
  @relations << relation
end

#add_table(name, table_object) ⇒ Object



16
17
18
19
# File 'lib/schemard/schema.rb', line 16

def add_table(name, table_object)
  @tables[name.to_s] = table_object
  table_object.set_schema(self)
end

#table(name) ⇒ Object



13
14
15
# File 'lib/schemard/schema.rb', line 13

def table(name)
  @tables[name.to_s]
end

#tablesObject



10
11
12
# File 'lib/schemard/schema.rb', line 10

def tables
  @tables.values
end