Class: Fnord::Client
- Inherits:
-
Object
- Object
- Fnord::Client
- Defined in:
- lib/fnord/client.rb
Class Attribute Summary collapse
-
.logger ⇒ Object
Set to any standard logger instance (including stdlib’s Logger) to enable stat logging using logger.debug.
-
.namespace ⇒ Object
Set to any standard logger instance (including stdlib’s Logger) to enable stat logging using logger.debug.
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #event(*args) ⇒ Object
-
#initialize(host, port = 1337, options = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(host, port = 1337, options = {}) ⇒ Client
Returns a new instance of Client.
15 16 17 |
# File 'lib/fnord/client.rb', line 15 def initialize(host, port = 1337, = {}) @host, @port, @options = host, port, end |
Class Attribute Details
.logger ⇒ Object
Set to any standard logger instance (including stdlib’s Logger) to enable stat logging using logger.debug
10 11 12 |
# File 'lib/fnord/client.rb', line 10 def logger @logger end |
.namespace ⇒ Object
Set to any standard logger instance (including stdlib’s Logger) to enable stat logging using logger.debug
10 11 12 |
# File 'lib/fnord/client.rb', line 10 def namespace @namespace end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
13 14 15 |
# File 'lib/fnord/client.rb', line 13 def connection @connection end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/fnord/client.rb', line 5 def host @host end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/fnord/client.rb', line 5 def @options end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/fnord/client.rb', line 5 def port @port end |
Instance Method Details
#event(*args) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/fnord/client.rb', line 19 def event(*args) = (args) event_name = args.shift [:_type] = event_name if event_name [:_namespace] = self.class.namespace unless [:_namespace] = stringify_values() send_to_connection(to_json()) end |