Class: Oxford::Facts
- Inherits:
-
Object
- Object
- Oxford::Facts
- Defined in:
- lib/oxford/facts.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#all ⇒ Object
readonly
Returns the value of attribute all.
Instance Method Summary collapse
-
#initialize ⇒ Facts
constructor
A new instance of Facts.
- #method_missing(m, *args, &block) ⇒ Object
- #networks ⇒ Object
- #processors ⇒ Object
Constructor Details
#initialize ⇒ Facts
Returns a new instance of 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 (readonly)
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 |