Module: TheSchemaIs::Common
- Extended by:
- Memoist
- Included in:
- MissingColumn, Presence, UnknownColumn, WrongColumnDefinition, WrongTableName
- Defined in:
- lib/the_schema_is/cops.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#external_dependency_checksum ⇒ Object
We need this method to tell Rubocop that EVEN if app/models/user.rb haven’t changed, and .rubocop.yml haven’t changed, we STILL may need to rerun the cop if schema.rb have changed.
- #on_class(node) ⇒ Object
Class Method Details
.included(cls) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/the_schema_is/cops.rb', line 30 def self.included(cls) cls.define_singleton_method(:badge) do RuboCop::Cop::Badge.for("TheSchemaIs::#{name.split('::').last}") end super end |
Instance Method Details
#external_dependency_checksum ⇒ Object
We need this method to tell Rubocop that EVEN if app/models/user.rb haven’t changed, and .rubocop.yml haven’t changed, we STILL may need to rerun the cop if schema.rb have changed.
47 48 49 50 51 |
# File 'lib/the_schema_is/cops.rb', line 47 def external_dependency_checksum return unless schema_path Digest::SHA1.hexdigest(File.read(schema_path)) end |