Class: Hookit::Resource::Socket

Inherits:
Base
  • Object
show all
Defined in:
lib/hookit/resource/socket.rb

Instance Attribute Summary

Attributes inherited from Base

#dict

Instance Method Summary collapse

Methods inherited from Base

#action, actions, #can_run?, default_action, #default_action, field, #not_if, #only_if

Constructor Details

#initialize(name) ⇒ Socket

Returns a new instance of Socket.



13
14
15
16
17
# File 'lib/hookit/resource/socket.rb', line 13

def initialize(name)
  service name unless service
  max_checks 3 unless max_checks
  super
end

Instance Method Details

#run(action) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/hookit/resource/socket.rb', line 19

def run(action)
  case action
  when :listening
    check_listening!
  when :no_connections
    check_no_connections!
  when :reset
    reset!
  end
end