Hello,
The code below prints:
#<Gem::Platform:0x..fdbdf0696 @cpu="x86", @os="linux", @version=nil>
--
that is, the @arch, @os and @classifier are empty.
(if i set these variables in the id method, they work fine)
(Gem::Platform.local is a class method that creates a new Gem::Platform
instance and returns it)
thank you for your help,
ittay
code below:
require 'rubygems'
require 'rubygems/version'
require 'rubygems/platform'
module Platform
class << self
attr_reader :arch
attr_reader :os
attr_reader :classifier
@arch = Gem::Platform.local.cpu
@os = Gem::Platform.local.os
@classifier = Gem::Platform.local.version
def id
"#{@arch}-#{@os}-#{@classifier}"
end
end
end
puts Gem::Platform.local.inspect
puts Platform.id
--
Posted via http://www.ruby-forum.com/.