Class: Oxford::Facts
- Inherits:
-
Object
show all
- Defined in:
- lib/oxford/facts.rb
Defined Under Namespace
Classes: Linux, OSX
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Facts
14
15
16
|
# File 'lib/oxford/facts.rb', line 14
def initialize
@all = Facter.to_hash
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/oxford/facts.rb', line 6
def method_missing(m, *args, &block)
if @all.has_key?(m.to_s)
@all[m.to_s]
else
raise NoMethodError
end
end
|
Instance Attribute Details
#all ⇒ Object
Returns the value of attribute all.
4
5
6
|
# File 'lib/oxford/facts.rb', line 4
def all
@all
end
|
Instance Method Details
#networks ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/oxford/facts.rb', line 18
def networks
networks = Hash.new
@all['interfaces'].split(',').each do |interface|
networks[interface] = {
'interface' => interface,
'ipaddress' => @all["ipaddress_#{interface}"],
'macaddress' => @all["macaddress_#{interface}"],
'network' => @all["network_#{interface}"],
'netmask' => @all["netmask_#{interface}"]
}
end
networks
end
|
#processors ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/oxford/facts.rb', line 32
def processors
case @all['operatingsystem']
when 'CentOS', 'RedHat'
Facts::Linux.processors(@all)
when 'Darwin'
Facts::OSX.processors(@all)
end
end
|