Module: Staypuft::Concerns::HostDetailsHelper
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/staypuft/concerns/host_details_helper.rb
Instance Method Summary collapse
-
#architectures ⇒ Object
Returns architecture.
-
#cpus ⇒ Object
Returns total number of processes.
-
#mem ⇒ Object
Returns memory in GB.
-
#model_type ⇒ Object
Returns model.
-
#network_interfaces ⇒ Object
Returns array of NIC names.
Instance Method Details
#architectures ⇒ Object
Returns architecture
47 48 49 50 51 52 53 |
# File 'app/models/staypuft/concerns/host_details_helper.rb', line 47 def architectures if self.facts_hash["architecture"] self.facts_hash["architecture"].name else nil end end |
#cpus ⇒ Object
Returns total number of processes
28 29 30 |
# File 'app/models/staypuft/concerns/host_details_helper.rb', line 28 def cpus self.facts_hash["processorcount"] end |
#mem ⇒ Object
Returns memory in GB
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/models/staypuft/concerns/host_details_helper.rb', line 7 def mem mem_arr = self.facts_hash["memorytotal"] if mem_arr mem_str, mem_unit = mem_arr.split(" ") mem_number = mem_str.to_f case mem_unit when "MB" mem_number / 1024 when "GB" mem_number when "TB" mem_number * 1024 else nil end else nil end end |
#model_type ⇒ Object
Returns model
33 34 35 |
# File 'app/models/staypuft/concerns/host_details_helper.rb', line 33 def model_type self.facts_hash["hardwaremodel"] end |
#network_interfaces ⇒ Object
Returns array of NIC names
38 39 40 41 42 43 44 |
# File 'app/models/staypuft/concerns/host_details_helper.rb', line 38 def network_interfaces if self.facts_hash["interfaces"] self.facts_hash["interfaces"].split(",") else nil end end |