Class: RuboCop::Select::File

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/select/file.rb

Class Method Summary collapse

Class Method Details

.expand_files(files, base_dir) ⇒ Object

TODO: I don’t want to access actual file system



16
17
18
# File 'lib/rubocop/select/file.rb', line 16

def self.expand_files(files, base_dir)
  files.map { |f| Pathname.new(::File.expand_path(f, base_dir)) }
end

.intersect(before_files = [], before_base_dir = Dir.pwd, after_files = [], after_base_dir = Dir.pwd) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/rubocop/select/file.rb', line 5

def self.intersect(
  before_files = [],
    before_base_dir = Dir.pwd,
    after_files = [],
    after_base_dir = Dir.pwd
)
  expand_files(before_files, before_base_dir) \
  & expand_files(after_files, after_base_dir)
end