Class: SchemaRD::Schema
- Inherits:
-
Object
- Object
- SchemaRD::Schema
- Defined in:
- lib/schemard/schema.rb
Instance Attribute Summary collapse
-
#relations ⇒ Object
readonly
Returns the value of attribute relations.
Instance Method Summary collapse
- #add_relation(relation) ⇒ Object
- #add_table(name, table_object) ⇒ Object
-
#initialize ⇒ Schema
constructor
A new instance of Schema.
- #table(name) ⇒ Object
- #tables ⇒ Object
Constructor Details
#initialize ⇒ Schema
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
#relations ⇒ Object (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 |
#tables ⇒ Object
10 11 12 |
# File 'lib/schemard/schema.rb', line 10 def tables @tables.values end |