Class: RuboCop::Rails::SchemaLoader::Table
- Inherits:
-
Object
- Object
- RuboCop::Rails::SchemaLoader::Table
- Defined in:
- lib/rubocop/rails/schema_loader/schema.rb
Overview
Represent a table
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#indices ⇒ Object
readonly
Returns the value of attribute indices.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(node) ⇒ Table
constructor
A new instance of Table.
- #with_column?(name:) ⇒ Boolean
Constructor Details
#initialize(node) ⇒ Table
Returns a new instance of Table.
74 75 76 77 78 |
# File 'lib/rubocop/rails/schema_loader/schema.rb', line 74 def initialize(node) @name = node.send_node.first_argument.value @columns = build_columns(node) @indices = build_indices(node) end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
72 73 74 |
# File 'lib/rubocop/rails/schema_loader/schema.rb', line 72 def columns @columns end |
#indices ⇒ Object (readonly)
Returns the value of attribute indices.
72 73 74 |
# File 'lib/rubocop/rails/schema_loader/schema.rb', line 72 def indices @indices end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
72 73 74 |
# File 'lib/rubocop/rails/schema_loader/schema.rb', line 72 def name @name end |
Instance Method Details
#with_column?(name:) ⇒ Boolean
80 81 82 |
# File 'lib/rubocop/rails/schema_loader/schema.rb', line 80 def with_column?(name:) @columns.any? { |c| c.name == name } end |