Class: Migsupo::Schema::SchemaDefinition
- Inherits:
-
Object
- Object
- Migsupo::Schema::SchemaDefinition
- Defined in:
- lib/migsupo/schema/schema_definition.rb
Instance Attribute Summary collapse
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
-
#initialize(tables: {}) ⇒ SchemaDefinition
constructor
A new instance of SchemaDefinition.
- #table(table_name) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(tables: {}) ⇒ SchemaDefinition
Returns a new instance of SchemaDefinition.
6 7 8 9 |
# File 'lib/migsupo/schema/schema_definition.rb', line 6 def initialize(tables: {}) @tables = tables.freeze freeze end |
Instance Attribute Details
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
4 5 6 |
# File 'lib/migsupo/schema/schema_definition.rb', line 4 def tables @tables end |
Instance Method Details
#table(table_name) ⇒ Object
11 12 13 |
# File 'lib/migsupo/schema/schema_definition.rb', line 11 def table(table_name) @tables[table_name.to_s] end |
#to_h ⇒ Object
15 16 17 |
# File 'lib/migsupo/schema/schema_definition.rb', line 15 def to_h { tables: tables.transform_values(&:to_h) } end |