Sha256: 29318cbf1c300c48f33927b288fd362e26ccd4d826c309a910ba4d0276f5aa3d
Contents?: true
Size: 1017 Bytes
Versions: 1
Compression:
Stored size: 1017 Bytes
Contents
require "ruby_xymon/version" require 'socket' module RubyXymon def self.send(msg, this_host=nil, this_port=nil) host = this_host.nil? ? self.config[:host] : this_host port = this_port.nil? ? self.config[:port] : this_port # create t = self.new_socket(host, port) # write t.puts(msg) # close t.close end def self.config=(hash_or_yml_file={}) case hash_or_yml_file when Hash @_xymon_config = default_config.merge(hash_or_yml_file) when String @_xymon_config = default_config.merge(YAML.load_file(hash_or_yml_file)) else raise ArgumentError.new("config takes either a Hash type object or a filename pointing to a YAML") end end def self.config if @_xymon_config.nil? @_xymon_config = default_config end @_xymon_config end def self.new_socket(host, port) TCPSocket.new(host, port) end def self.default_config { :host => 'localhost', :port => '1984' } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_xymon-0.0.2 | lib/ruby_xymon.rb |