I found following exp from html_parser.rb
n = Integer(name)
here, name is string
Is the Integer used as class method?
it looks like converting from str to int.
Where can I get this info?
I checked "the ruby way’ and "programming ruby’
but i couldn’t find any info about it.
thanks.
s moon
In fact it’s Kernel.Integer(name) cf
http://www.rubycentral.com/book/ref_m_kernel.html#Kernel.Integer
Integer is a “method” of the Kernel module.
s moon wrote:
···
I found following exp from html_parser.rb
n = Integer(name)
here, name is string
Is the Integer used as class method?
it looks like converting from str to int.
Where can I get this info?
I checked "the ruby way’ and "programming ruby’
but i couldn’t find any info about it.
thanks.
s moon
“s moon” internetletter@yahoo.com wrote in message
[snip]
Is the Integer used as class method?
it looks like converting from str to int.
Where can I get this info?
C:>ri Integer
This is a test ‘ri’. Please report errors and omissions
on http://www.rubygarden.org/ruby?RIOnePointEight
···
class: Integer < Numeric
Subclassed by: Bignum, Fixnum
Integer is the basis for the two concrete classes that hold whole
numbers, Bignum and Fixnum.
ceil, chr, downto, floor, integer?, next, round, succ, times, to_i,
to_int, truncate, upto
C:>
That’s not the one he wants
batsman@tux-chan:~/src/rdocsite/site/ruby$ ri Kernel.Integer
-------------------------------------------------------- Kernel::Integer
Integer( arg ) → anInteger
···
On Tue, Jul 08, 2003 at 09:01:26AM +0900, Shashank Date wrote:
“s moon” internetletter@yahoo.com wrote in message
[snip]
Is the Integer used as class method?
it looks like converting from str to int.
Where can I get this info?
C:>ri Integer
Converts arg to a Fixnum or Bignum. Numeric types are converted
directly (with floating point numbers being truncated). If arg is a
String, leading radix indicators (0, 0b, and 0x) are honored. This
behavior is different from that of String#to_i.
Integer(123.999) #=> 123
Integer("0x1a") #=> 26
Integer(Time.new) #=> 983770240
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
martin@bdsi.com (no longer valid - where are you now, Martin?)
– from /usr/src/linux/drivers/cdrom/mcd.c
Mauricio Fernández wrote:
batsman@tux-chan:~/src/rdocsite/site/ruby$ ri Kernel.Integer
-------------------------------------------------------- Kernel::Integer
Integer( arg ) → anInteger
Converts arg to a Fixnum or Bignum. Numeric types are converted
directly (with floating point numbers being truncated). If arg is a
String, leading radix indicators (0, 0b, and 0x) are honored. This
behavior is different from that of String#to_i.
Integer(123.999) #=> 123
Integer("0x1a") #=> 26
Integer(Time.new) #=> 983770240
But don’t forget that Integer( nil ) #=> 0
···
–
Andrey Kulinich
IT Group
Software developer
Phone/Fax +380 (372) 58-43-10
e-mail: Andrey.Kulinich@itgrp.net
http://www.itgrp.net