class OhMyLog::Log::Result

Attributes

effects[R]
request[R]

Public Class Methods

new(request) click to toggle source
# File lib/oh_my_log/result.rb, line 8
def initialize(request)
  @request = request
  @effects = calculate_effects
end

Public Instance Methods

record!() click to toggle source

call this to record the current action done by the user

# File lib/oh_my_log/result.rb, line 14
def record!
  if OhMyLog::Log.configuration.print_log
    p "REQUEST"
    p @request.to_s
    p "RESPONSE" unless @effects.empty?
    @effects.each {|effect| p effect.to_s}
  end

  print_into_log

  #we can record everything that happend (OPTIONALL)
  if OhMyLog::Log.configuration.record_history
    OhMyLog::Log.history << self
  end
  #We always save the last operation recorded
  OhMyLog::Log.last_recorded = self
  #save this string on file or upload it somewhere
end

Private Instance Methods

calculate_effects() click to toggle source
# File lib/oh_my_log/result.rb, line 49
def calculate_effects
  return OhMyLog::Log::targets.map {|target| Effect.new(target)}
end
print_into_log() click to toggle source