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:)
···
--
Posted via http://www.ruby-forum.com/\.
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:
···
El Lunes, 18 de Enero de 2010, Atheeq Pasha escribió:
3
--
Iñaki Baz Castillo <ibc@aliax.net>
Iñaki Baz Castillo wrote:
···
El Lunes, 18 de Enero de 2010, Atheeq Pasha 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:
> 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..
--
Posted via http://www.ruby-forum.com/\.
Try:
manager = Manager.new(:Host => result.address)
varbind = VarBind.new("#{oid}.#{result.reset_port}", 3)
manager.set(varbind)
···
On Mon, Jan 18, 2010 at 4:53 PM, Atheeq Pasha <atheeq@carmatec.com> wrote:
Iñaki Baz Castillo wrote:
El Lunes, 18 de Enero de 2010, Atheeq Pasha escribió:
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:
> 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..