lib/cpu/shared.rb in cpu-0.0.4 vs lib/cpu/shared.rb in cpu-0.0.6
- old
+ new
@@ -1,10 +1,10 @@
module CPU
module Shared
# Returns the number of processors in this computer
def num_processors
- if @num_processors
+ if defined?(@num_processors)
@num_processors
else
CPU.num_processors
end
end
@@ -13,10 +13,10 @@
# object the CPU::Shared module was mixed into).
attr_writer :num_processors
# Returns the number of cores in this computer
def num_cores
- if @num_cores
+ if defined?(@num_cores)
@num_cores
else
CPU.num_cores
end
end