Class: BackupOrganizer::FileAge

Inherits:
BasicObject
Includes:
Comparable
Defined in:
lib/backup_organizer/file_age.rb

Instance Method Summary collapse

Constructor Details

#initialize(age) ⇒ FileAge

Returns a new instance of FileAge.



9
10
11
# File 'lib/backup_organizer/file_age.rb', line 9

def initialize(age)
  @age = age
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *attrs) ⇒ Object



27
28
29
# File 'lib/backup_organizer/file_age.rb', line 27

def method_missing(name, *attrs)
  @age.send(name, *attrs)
end

Instance Method Details

#<=>(b) ⇒ Object



13
14
15
16
# File 'lib/backup_organizer/file_age.rb', line 13

def <=>(b)
  b = b.to_f if b.respond_to?(:to_f)
  @age.<=>(b)
end

#is_a?(klass) ⇒ Boolean Also known as: kind_of?

Returns:

  • (Boolean)


22
23
24
# File 'lib/backup_organizer/file_age.rb', line 22

def is_a?(klass)
  FileAge == klass || @age.is_a?(klass)
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/backup_organizer/file_age.rb', line 18

def respond_to?(method)
  @age.respond_to?(method)
end