Class: Ixtlan::Errors::Dumper

Inherits:
Object
  • Object
show all
Includes:
Slf4r::Logger
Defined in:
lib/ixtlan/errors/dumper.rb

Defined Under Namespace

Classes: Log

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model = nil, &block) ⇒ Dumper

Returns a new instance of Dumper.



50
51
52
53
54
55
# File 'lib/ixtlan/errors/dumper.rb', line 50

def initialize( model = nil, &block )
  @model = model
  @keep_dumps = 0
  block.call( self ) if block
  @block = block
end

Instance Attribute Details

#base_urlObject

Returns the value of attribute base_url.



48
49
50
# File 'lib/ixtlan/errors/dumper.rb', line 48

def base_url
  @base_url
end

#blockObject

Returns the value of attribute block.



48
49
50
# File 'lib/ixtlan/errors/dumper.rb', line 48

def block
  @block
end

#from_emailObject

Returns the value of attribute from_email.



48
49
50
# File 'lib/ixtlan/errors/dumper.rb', line 48

def from_email
  @from_email
end

#keep_dumpsObject

Returns the value of attribute keep_dumps.



48
49
50
# File 'lib/ixtlan/errors/dumper.rb', line 48

def keep_dumps
  @keep_dumps
end

#modelObject

Returns the value of attribute model.



48
49
50
# File 'lib/ixtlan/errors/dumper.rb', line 48

def model
  @model
end

#to_emailsObject

Returns the value of attribute to_emails.



48
49
50
# File 'lib/ixtlan/errors/dumper.rb', line 48

def to_emails
  @to_emails
end

Instance Method Details

#dump(exception, request, response, session, params) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ixtlan/errors/dumper.rb', line 67

def dump( exception, request, response, session , params )
  update_config

  daily_cleanup

  error = dump_environment( exception, 
                            request, 
                            response, 
                            session, 
                            params )

  if not error.id.nil? and not @to_emails.blank? and not @from_email.blank?
    Mailer.error_notification( @from_email, 
                               @to_emails, 
                               exception, 
                               "#{@base_url}/#{error.id}" ).deliver
    true
  else
    false
  end
end