Class: Plat4m::System::Platform
- Inherits:
-
Object
- Object
- Plat4m::System::Platform
- Defined in:
- lib/plat4m/system.rb
Overview
Provides information about the hardware platform.
Instance Attribute Summary collapse
-
#arch ⇒ Object
readonly
Returns the value of attribute arch.
-
#bits ⇒ Object
readonly
Returns the value of attribute bits.
-
#cpus ⇒ Object
readonly
Returns the value of attribute cpus.
Instance Method Summary collapse
- #complete? ⇒ Boolean
-
#initialize(arch: nil, cpus: nil) ⇒ Platform
constructor
A new instance of Platform.
- #to_s ⇒ Object
Constructor Details
#initialize(arch: nil, cpus: nil) ⇒ Platform
Returns a new instance of Platform.
16 17 18 19 20 |
# File 'lib/plat4m/system.rb', line 16 def initialize(arch: nil, cpus: nil) @arch = arch @bits = @arch.to_s =~ /64/ ? 64 : 32 @cpus = cpus end |
Instance Attribute Details
#arch ⇒ Object (readonly)
Returns the value of attribute arch.
22 23 24 |
# File 'lib/plat4m/system.rb', line 22 def arch @arch end |
#bits ⇒ Object (readonly)
Returns the value of attribute bits.
22 23 24 |
# File 'lib/plat4m/system.rb', line 22 def bits @bits end |
#cpus ⇒ Object (readonly)
Returns the value of attribute cpus.
22 23 24 |
# File 'lib/plat4m/system.rb', line 22 def cpus @cpus end |
Instance Method Details
#complete? ⇒ Boolean
24 25 26 27 |
# File 'lib/plat4m/system.rb', line 24 def complete? ::String === @arch && !@arch.empty? && ::Integer === cpus && @cpus>0 end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/plat4m/system.rb', line 29 def to_s "[#{@arch}: #{@bits}bits, #{cpus} cpu]" end |