I
Ittay Dror
Hello,
The code below prints:
#<Gem:
latform: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:
latform.local is a class method that creates a new Gem:
latform
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
s
attr_reader :classifier
@arch = Gem:
latform.local.cpu
@os = Gem:
latform.local.os
@classifier = Gem:
latform.local.version
def id
"#{@arch}-#{@os}-#{@classifier}"
end
end
end
puts Gem:
latform.local.inspect
puts Platform.id
The code below prints:
#<Gem:
--
that is, the @arch, @os and @classifier are empty.
(if i set these variables in the id method, they work fine)
(Gem:
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
attr_reader :classifier
@arch = Gem:
@os = Gem:
@classifier = Gem:
def id
"#{@arch}-#{@os}-#{@classifier}"
end
end
end
puts Gem:
puts Platform.id