Class: Protor
- Inherits:
-
Object
- Object
- Protor
- Includes:
- MonitorMixin
- Defined in:
- lib/protor.rb,
lib/protor/entry.rb,
lib/protor/version.rb,
lib/protor/registry.rb,
lib/protor/udp_client.rb,
lib/protor/entry_family.rb,
lib/protor/logger_client.rb,
lib/protor/udp_formatter.rb
Defined Under Namespace
Classes: Entry, EntryFamily, IncompatibleTypeError, InvalidAdditionalError, InvalidLabelNameError, InvalidLabelValueError, InvalidNameError, InvalidTypeError, LoggerClient, Registry, UDPClient, UDPFormatter
Constant Summary collapse
- DEFAULT_CONFIG =
{ client: :udp, formatter: :udp, host: 'localhost', port: 10601, packet_size: 56_607 }
- VERSION =
'0.1.2'
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
-
#initialize {|config| ... } ⇒ Protor
constructor
A new instance of Protor.
- #publish ⇒ Object
Constructor Details
#initialize {|config| ... } ⇒ Protor
Returns a new instance of Protor.
22 23 24 25 26 27 28 |
# File 'lib/protor.rb', line 22 def initialize(&block) super(&block) @config = DEFAULT_CONFIG.dup @registry = Registry.new yield(config) if block_given? end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
20 21 22 |
# File 'lib/protor.rb', line 20 def config @config end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
20 21 22 |
# File 'lib/protor.rb', line 20 def registry @registry end |
Instance Method Details
#publish ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/protor.rb', line 30 def publish safely do client.publish(registry) registry.reset end logger.debug("publish") if logger end |