Class: Sanford::ConnectionHandler
- Inherits:
-
Object
- Object
- Sanford::ConnectionHandler
- Defined in:
- lib/sanford/connection_handler.rb
Defined Under Namespace
Modules: RoundedTime, SummaryLine Classes: ProcessedService
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#server_data ⇒ Object
readonly
Returns the value of attribute server_data.
Instance Method Summary collapse
-
#initialize(server_data, connection) ⇒ ConnectionHandler
constructor
A new instance of ConnectionHandler.
- #run ⇒ Object
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
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
11 12 13 |
# File 'lib/sanford/connection_handler.rb', line 11 def connection @connection end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/sanford/connection_handler.rb', line 12 def logger @logger end |
#server_data ⇒ Object (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
#run ⇒ Object
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 |