Class: CleanUp::Conditions::Name

Inherits:
Object
  • Object
show all
Defined in:
lib/clean_up/conditions/name.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Name

Returns a new instance of Name.



4
5
6
# File 'lib/clean_up/conditions/name.rb', line 4

def initialize(value)
  @pattern = Array(value)
end

Instance Method Details

#match?(file) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/clean_up/conditions/name.rb', line 8

def match?(file)
  @pattern.any? do |filename|
    filename == File.basename(file, '.*')
  end
end