Class: BackupOrganizer::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/backup_organizer/rule.rb

Instance Method Summary collapse

Constructor Details

#initialize(directory) ⇒ Rule

Returns a new instance of Rule.



3
4
5
# File 'lib/backup_organizer/rule.rb', line 3

def initialize(directory)
  @directory = directory
end

Instance Method Details

#applies_for?(file) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/backup_organizer/rule.rb', line 11

def applies_for?(file)
  file.extend(Extensions::FileExtensions)
  @rule.call(file)
end

#directoryObject



16
17
18
# File 'lib/backup_organizer/rule.rb', line 16

def directory
  @directory
end

#if(&rule) ⇒ Object



7
8
9
# File 'lib/backup_organizer/rule.rb', line 7

def if(&rule)
  @rule = rule
end