Module: Dragonfly::Loggable

Defined in:
lib/dragonfly/loggable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#log_objectObject (readonly)

Returns the value of attribute log_object



21
22
23
# File 'lib/dragonfly/loggable.rb', line 21

def log_object
  @log_object
end

Instance Method Details

#logObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/dragonfly/loggable.rb', line 6

def log
  case @log_object
  when nil
    @log_object = Logger.new($stdout)
  when Proc
    @log_object[]
  when Logger
    @log_object
  end
end

#log=(object) ⇒ Object



17
18
19
# File 'lib/dragonfly/loggable.rb', line 17

def log=(object)
  @log_object = object
end

#use_same_log_as(object) ⇒ Object



23
24
25
# File 'lib/dragonfly/loggable.rb', line 23

def use_same_log_as(object)
  self.log = proc{ object.log }
end