Class: Relocator::CLI::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/relocator/cli/files.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name, glob: "**/*.rb") ⇒ Files



6
7
8
9
# File 'lib/relocator/cli/files.rb', line 6

def initialize(class_name, glob: "**/*.rb")
  self.class_name = class_name
  self.glob = glob
end

Class Method Details

.call(*args) ⇒ Object



2
3
4
# File 'lib/relocator/cli/files.rb', line 2

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
# File 'lib/relocator/cli/files.rb', line 11

def call
  Dir[glob].reject do |filename|
    File
      .open(filename)
      .grep(class_name_regexp)
      .empty?
  end
end