Class: Rails::Schema::Transformer::Node
- Inherits:
-
Object
- Object
- Rails::Schema::Transformer::Node
- Defined in:
- lib/rails/schema/transformer/node.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
-
#initialize(id:, table_name:, columns: [], group: []) ⇒ Node
constructor
A new instance of Node.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, table_name:, columns: [], group: []) ⇒ Node
Returns a new instance of Node.
9 10 11 12 13 14 |
# File 'lib/rails/schema/transformer/node.rb', line 9 def initialize(id:, table_name:, columns: [], group: []) @id = id @table_name = table_name @columns = columns @group = group end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
7 8 9 |
# File 'lib/rails/schema/transformer/node.rb', line 7 def columns @columns end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
7 8 9 |
# File 'lib/rails/schema/transformer/node.rb', line 7 def group @group end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/rails/schema/transformer/node.rb', line 7 def id @id end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
7 8 9 |
# File 'lib/rails/schema/transformer/node.rb', line 7 def table_name @table_name end |
Instance Method Details
#to_h ⇒ Object
16 17 18 19 20 |
# File 'lib/rails/schema/transformer/node.rb', line 16 def to_h h = { id: @id, table_name: @table_name, columns: @columns } h[:group] = @group unless @group.empty? h end |