class Naginata::Configuration::NagiosServer::Properties

Public Class Methods

new() click to toggle source
# File lib/naginata/configuration/nagios_server.rb, line 38
def initialize
  @properties = {}
end

Public Instance Methods

fetch(key) click to toggle source
# File lib/naginata/configuration/nagios_server.rb, line 53
def fetch(key)
  @properties[key]
end
keys() click to toggle source
# File lib/naginata/configuration/nagios_server.rb, line 61
def keys
  @properties.keys
end
method_missing(key, value=nil) click to toggle source
# File lib/naginata/configuration/nagios_server.rb, line 65
def method_missing(key, value=nil)
  if value
    set(lvalue(key), value)
  else
    fetch(key)
  end
end
respond_to?(method, include_all=false) click to toggle source
# File lib/naginata/configuration/nagios_server.rb, line 57
def respond_to?(method, include_all=false)
  @properties.has_key?(method)
end
set(key, value) click to toggle source
# File lib/naginata/configuration/nagios_server.rb, line 42
def set(key, value)
  pval = @properties[key]
  if pval.is_a? Hash and value.is_a? Hash
    pval.merge!(value)
  elsif pval.is_a? Array and value.is_a? Array
    pval.concat value
  else
    @properties[key] = value
  end
end

Private Instance Methods

lvalue(key) click to toggle source
# File lib/naginata/configuration/nagios_server.rb, line 75
def lvalue(key)
  key.to_s.chomp('=').to_sym
end