Class: Unbreakable::Observers::Log

Inherits:
Observer
  • Object
show all
Defined in:
lib/unbreakable/observers/log.rb

Overview

Logs debug messages when files are stored or skipped if the observed object has a #log method.

Instance Attribute Summary

Attributes inherited from Observer

#observed

Instance Method Summary collapse

Methods inherited from Observer

#initialize

Constructor Details

This class inherits a constructor from Unbreakable::Observers::Observer

Instance Method Details

#update(method, *args) ⇒ void

This method returns an undefined value.

Parameters:

  • method (Symbol)

    the method called on the observed object

  • args (Array)

    the arguments to the method



7
8
9
10
11
12
13
14
15
16
# File 'lib/unbreakable/observers/log.rb', line 7

def update(method, *args)
  if observed.respond_to? :log
    case method
    when :store
      observed.log.debug "Store #{args.first}"
    when :skip
      observed.log.debug "Skip #{args.first}"
    end
  end
end