module Asbestos
Constants
- HOMEPAGE
- VERSION
Public Class Methods
firewall()
click to toggle source
# File lib/asbestos.rb, line 28 def self.firewall case os when :linux Asbestos::Firewall::IPTables when :darwin #FIXME Asbestos::Firewall::IPTables end end
hostname()
click to toggle source
# File lib/asbestos.rb, line 11 def self.hostname Socket.gethostname[/[^.]*/] end
interfaces()
click to toggle source
# File lib/asbestos.rb, line 15 def self.interfaces System.get_ifaddrs end
os()
click to toggle source
# File lib/asbestos.rb, line 19 def self.os case when RUBY_PLATFORM[/linux/i] :linux when RUBY_PLATFORM[/darwin/i] :darwin end end
reset!()
click to toggle source
# File lib/asbestos.rb, line 38 def self.reset! [ Host.all, Host.groups, HostTemplate.all, Address.all, RuleSet.all, Service.all, ].each do |collection| collection.delete_if {|_| true} end end
with_indifferent_access!(hash)
click to toggle source
Didn’t want to monkeypatch the Hash class.
# File lib/asbestos.rb, line 54 def self.with_indifferent_access!(hash) class << hash def [](key) fetch key.to_sym rescue KeyError # key not found nil end def []=(key, value) store key.to_sym, value end end end