Hello,
how to use Integer class in ruby?? When I enter this from irb console,
this error is thrown out…
Integer.new(3)
NoMethodError: undefined method `new’ for Integer:Class
from (irb):182
Thanks in advance:)
Hello,
how to use Integer class in ruby?? When I enter this from irb console,
this error is thrown out…
Integer.new(3)
NoMethodError: undefined method `new’ for Integer:Class
from (irb):182
Thanks in advance:)
El Lunes, 18 de Enero de 2010, Atheeq P. escribió:
Hello,
how to use Integer class in ruby?? When I enter this from irb console,
this error is thrown out…Integer.new(3)
NoMethodError: undefined method `new’ for Integer:Class
from (irb):182
Integer doesn’t allow “new” method as Integer is an especial class
(Integer 1
has a fixed ibject_id, as 2, 3 and so on).
To create a Fixnum 3 just do:
irb> 3
Iñaki Baz C. wrote:
El Lunes, 18 de Enero de 2010, Atheeq P. escribió:
Hello,
how to use Integer class in ruby?? When I enter this from irb console,
this error is thrown out…Integer.new(3)
NoMethodError: undefined method `new’ for Integer:Class
from (irb):182Integer doesn’t allow “new” method as Integer is an especial class
(Integer 1
has a fixed ibject_id, as 2, 3 and so on).To create a Fixnum 3 just do:
irb> 3
I am using this in snmpset implementation of the SNMP ruby
manager = Manager.new(:Host => result.address)
varbind =
VarBind.new(oid.to_s+’.’+result.reset_port.to_s,Integer.new(3))
manager.set(varbind)
Where i get this error…
On Mon, Jan 18, 2010 at 4:53 PM, Atheeq P. [email protected]
wrote:
(Integer 1
VarBind.new(oid.to_s+‘.’+result.reset_port.to_s,Integer.new(3))
manager.set(varbind)Where i get this error…
Try:
manager = Manager.new(:Host => result.address)
varbind = VarBind.new(“#{oid}.#{result.reset_port}”, 3)
manager.set(varbind)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs