Class: Safely::Strategy::Hoptoad

Inherits:
Object
  • Object
show all
Defined in:
lib/safely/strategy/hoptoad.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.hoptoad_hostObject

Returns the value of attribute hoptoad_host.



9
10
11
# File 'lib/safely/strategy/hoptoad.rb', line 9

def hoptoad_host
  @hoptoad_host
end

.hoptoad_keyObject

Hoptoad API key to use for reporting errors



8
9
10
# File 'lib/safely/strategy/hoptoad.rb', line 8

def hoptoad_key
  @hoptoad_key
end

Class Method Details

.load!Object



11
12
13
14
15
16
17
# File 'lib/safely/strategy/hoptoad.rb', line 11

def load!
  begin
    require 'toadhopper'
  rescue LoadError
    $stderr.write( "'toadhopper' not available, safely cannot use the Hoptoad stategy" )
  end
end

.report!(exception) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/safely/strategy/hoptoad.rb', line 19

def report!( exception )
  params = {}
  params[:notify_host] = self.hoptoad_host if !self.hoptoad_host.nil?

  if defined?( Toadhopper ) && !self.hoptoad_key.nil?
    Toadhopper.new(self.hoptoad_key, params).post!(exception)
  end
end