Class: SchemaToScaffold::Schema
- Inherits:
-
Object
- Object
- SchemaToScaffold::Schema
- Defined in:
- lib/schema_to_scaffold/schema.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Schema
constructor
A new instance of Schema.
- #table(id) ⇒ Object
- #table_names ⇒ Object
- #to_script ⇒ Object
Constructor Details
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/schema_to_scaffold/schema.rb', line 4 def data @data end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
4 5 6 |
# File 'lib/schema_to_scaffold/schema.rb', line 4 def tables @tables end |
Class Method Details
Instance Method Details
#table(id) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/schema_to_scaffold/schema.rb', line 14 def table(id) case id when Symbol then table(id.to_s) when String then tables[table_names.index(id)] when Fixnum then tables[id] else nil end end |
#table_names ⇒ Object
10 11 12 |
# File 'lib/schema_to_scaffold/schema.rb', line 10 def table_names tables.map(&:name) end |
#to_script ⇒ Object
23 24 25 |
# File 'lib/schema_to_scaffold/schema.rb', line 23 def to_script tables.map(&:to_script) end |