Class: Livestatus::Connection
- Inherits:
-
Object
- Object
- Livestatus::Connection
- Extended by:
- Forwardable
- Defined in:
- lib/livestatus/connection.rb
Instance Method Summary collapse
- #handler ⇒ Object
- #handler! ⇒ Object
-
#initialize(config) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(config) ⇒ Connection
Returns a new instance of Connection.
10 11 12 |
# File 'lib/livestatus/connection.rb', line 10 def initialize(config) @config = config.symbolize_keys! end |
Instance Method Details
#handler ⇒ Object
14 15 16 |
# File 'lib/livestatus/connection.rb', line 14 def handler @handler ||= handler! end |
#handler! ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/livestatus/connection.rb', line 18 def handler! case @config[:uri] when /^https?:\/\// PatronHandler.new(self, @config) when /^unix:\/\// UnixHandler.new(self, @config) else raise AttributeError, "unknown uri type: #{@config[:uri]}" end end |