Class: Sanford::ConnectionHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/sanford/connection_handler.rb

Defined Under Namespace

Modules: RoundedTime, SummaryLine Classes: ProcessedService

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_data, connection) ⇒ ConnectionHandler

Returns a new instance of ConnectionHandler.



14
15
16
17
18
19
20
21
# File 'lib/sanford/connection_handler.rb', line 14

def initialize(server_data, connection)
  @server_data = server_data
  @connection = connection
  @logger = Sanford::Logger.new(
    @server_data.logger,
    @server_data.verbose_logging
  )
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



11
12
13
# File 'lib/sanford/connection_handler.rb', line 11

def connection
  @connection
end

#loggerObject (readonly)

Returns the value of attribute logger.



12
13
14
# File 'lib/sanford/connection_handler.rb', line 12

def logger
  @logger
end

#server_dataObject (readonly)

Returns the value of attribute server_data.



11
12
13
# File 'lib/sanford/connection_handler.rb', line 11

def server_data
  @server_data
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/sanford/connection_handler.rb', line 23

def run
  processed_service = nil
  self.log_received
  benchmark = Benchmark.measure do
    processed_service = self.run!
  end
  processed_service.time_taken = RoundedTime.new(benchmark.real)
  self.log_complete(processed_service)
  processed_service
end