Class: Plat4m::System::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/plat4m/system.rb

Overview

Provides information about the hardware platform.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#archObject (readonly)

Returns the value of attribute arch.



22
23
24
# File 'lib/plat4m/system.rb', line 22

def arch
  @arch
end

#bitsObject (readonly)

Returns the value of attribute bits.



22
23
24
# File 'lib/plat4m/system.rb', line 22

def bits
  @bits
end

#cpusObject (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

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/plat4m/system.rb', line 24

def complete?
  ::String === @arch && !@arch.empty? &&
    ::Integer === cpus && @cpus>0
end

#to_sObject



29
30
31
# File 'lib/plat4m/system.rb', line 29

def to_s
  "[#{@arch}: #{@bits}bits, #{cpus} cpu]"
end