Module: RuboCop::Code0::ZeroTrack::FileHelpers
- Included in:
- RuboCop::Cop::Code0::ZeroTrack::Migration::CreateTableWithTimestamps, RuboCop::Cop::Code0::ZeroTrack::Migration::Datetime, RuboCop::Cop::Code0::ZeroTrack::Migration::Timestamps, RuboCop::Cop::Code0::ZeroTrack::Migration::VersionedClass
- Defined in:
- lib/rubocop/code0/zero_track/file_helpers.rb
Instance Method Summary collapse
- #basename(node) ⇒ Object
- #dirname(node) ⇒ Object
- #filepath(node) ⇒ Object
- #in_migration?(node) ⇒ Boolean
Instance Method Details
#basename(node) ⇒ Object
11 12 13 |
# File 'lib/rubocop/code0/zero_track/file_helpers.rb', line 11 def basename(node) File.basename(filepath(node)) end |
#dirname(node) ⇒ Object
7 8 9 |
# File 'lib/rubocop/code0/zero_track/file_helpers.rb', line 7 def dirname(node) File.dirname(filepath(node)) end |
#filepath(node) ⇒ Object
15 16 17 |
# File 'lib/rubocop/code0/zero_track/file_helpers.rb', line 15 def filepath(node) node.location.expression.source_buffer.name end |
#in_migration?(node) ⇒ Boolean
19 20 21 |
# File 'lib/rubocop/code0/zero_track/file_helpers.rb', line 19 def in_migration?(node) dirname(node).end_with?('db/migrate') end |