oct

Hi

oct-documentation points to Integer.

Where do I find these docs there??

thank you Opti

hello,

oct-documentation points to Integer.

  Mine says `Kernel#Integer':

    % ri oct
    […]
    If str starts with 0, radix indicators are honored. See
    Kernel#Integer.

Where do I find these docs there??

  `Kernel#Integer' or `#Integer' (#Integer is the method, Integer is
the class) :

    % ri #Integer
    = #Integer

    (from ruby core)
    === Implementation from Kernel

···

On 2021-11-16 11:52:08 +0100, Die Optimisten wrote:
    -----------------------------------------------------------------
      Integer(arg, base=0, exception: true) -> integer or nil

--
Thibault Jouan

Hi,
I know, but: could you paste me the text with the description please
(e.h. 0x...) ??
we are NOT speaking of Integer(10,16), BUT 0x10.oct !
(I said it's not documented anywhere...)
thanks Opti

···

Am 16.11.21 um 15:38 schrieb Thibault Jouan:

hello,

On 2021-11-16 11:52:08 +0100, Die Optimisten wrote:

oct-documentation points to Integer.

   Mine says `Kernel#Integer':

     % ri oct
     […]
     If str starts with 0, radix indicators are honored. See
     Kernel#Integer.

Where do I find these docs there??

   `Kernel#Integer' or `#Integer' (#Integer is the method, Integer is
the class) :

     % ri #Integer
     = #Integer

     (from ruby core)
     === Implementation from Kernel
     -----------------------------------------------------------------
       Integer(arg, base=0, exception: true) -> integer or nil

CLI:

$ ri oct
(from ruby core)
=== Implementation from String

···

On 11/16/21, Die Optimisten <inform@die-optimisten.net> wrote:

Am 16.11.21 um 15:38 schrieb Thibault Jouan:
> On 2021-11-16 11:52:08 +0100, Die Optimisten wrote:
> > oct-documentation points to Integer.
> > Where do I find these docs there??
>
> % ri oct
> […]
> If str starts with 0, radix indicators are honored. See
> Kernel#Integer.

I know, but: could you paste me the text with the description please
(e.h. 0x...) ??
we are NOT speaking of Integer(10,16), BUT 0x10.oct !
(I said it's not documented anywhere...)

------------------------------------------------------------------------
  str.oct -> integer

------------------------------------------------------------------------

Treats leading characters of str as a string of octal digits (with
an optional sign) and returns the corresponding number. Returns 0 if
the conversion fails.

  "123".oct #=> 83
  "-377".oct #=> -255
  "bad".oct #=> 0
  "0377bad".oct #=> 255

If str starts with 0, radix indicators are honored. See Kernel#Integer.

$ ri Kernel#Integer
(from ruby core)
------------------------------------------------------------------------
  Integer(arg, base=0, exception: true) -> integer or nil

------------------------------------------------------------------------
... If arg is a String, when base is omitted or equals zero, radix
indicators (0, 0b, and 0x) are honored. ...

  Integer("0x1a") #=> 26

Web:

https://ruby-doc.org/core-3.0.2/String.html#method-i-oct
https://ruby-doc.org/core-3.0.2/Kernel.html#method-i-Integer

ok - thank you
But: why is this not shown with ri Integer?? (therefore I didn't find it!)
Opti

···

Am 16.11.21 um 22:35 schrieb Frank J. Cameron:

On 11/16/21, Die Optimisten <inform@die-optimisten.net> wrote:

Am 16.11.21 um 15:38 schrieb Thibault Jouan:

On 2021-11-16 11:52:08 +0100, Die Optimisten wrote:

oct-documentation points to Integer.
Where do I find these docs there??

% ri oct
[…]
If str starts with 0, radix indicators are honored. See
Kernel#Integer.

I know, but: could you paste me the text with the description please
(e.h. 0x...) ??
we are NOT speaking of Integer(10,16), BUT 0x10.oct !
(I said it's not documented anywhere...)

CLI:

$ ri oct
(from ruby core)
=== Implementation from String
------------------------------------------------------------------------
   str.oct -> integer

------------------------------------------------------------------------

Treats leading characters of str as a string of octal digits (with
an optional sign) and returns the corresponding number. Returns 0 if
the conversion fails.

   "123".oct #=> 83
   "-377".oct #=> -255
   "bad".oct #=> 0
   "0377bad".oct #=> 255

If str starts with 0, radix indicators are honored. See Kernel#Integer.

$ ri Kernel#Integer
(from ruby core)
------------------------------------------------------------------------
   Integer(arg, base=0, exception: true) -> integer or nil

------------------------------------------------------------------------
... If arg is a String, when base is omitted or equals zero, radix
indicators (0, 0b, and 0x) are honored. ...

   Integer("0x1a") #=> 26

Web:

Class: String (Ruby 3.0.2)
Module: Kernel (Ruby 3.0.2)

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<ruby-talk list: member options login page>

If the documentation has not been generated locally, `ri` will not find
the documentation.

If you do `ri Array` you may find that documentation missing as well
(except for any documentation that may have been generated for gems that
you have installed).

···

On 21/11/17 12:42PM, Die Optimisten wrote:

ok - thank you
But: why is this not shown with ri Integer?? (therefore I didn't find it!)
Opti

How can I rebuild the index for ri?
Kernel#Integer is shown,
ri Integer does not include that item, (or is this a wanted behaviour?)
Opti

···

Am 18.11.21 um 03:47 schrieb Victor Goff:

On 21/11/17 12:42PM, Die Optimisten wrote:

ok - thank you
But: why is this not shown with ri Integer?? (therefore I didn't find it!)
Opti

If the documentation has not been generated locally, `ri` will not find
the documentation.

If you do `ri Array` you may find that documentation missing as well
(except for any documentation that may have been generated for gems that
you have installed).

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<ruby-talk list: member options login page>

How can I rebuild the index for ri?

It probably was never built for the core library.

Some folks have had luck doing

  $ gem install rdoc-data
  $ rdoc-data --install

I use RVM and so I will usually do:

  $ rvm docs generate-ri

Kernel#Integer is shown,
ri Integer does not include that item, (or is this a wanted behaviour?)

Integer should not include that item, it comes from String.
    >> "0x52".oct => 42

The documentation as shown by `ri 'String\#oct'`:

    # String#oct
    
    (from ruby site)

···

On 21/11/18 01:12PM, Die Optimisten wrote:
    ---
        str.oct -> integer
    
    ---
    
    Treats leading characters of *str* as a string of octal digits (with an
    optional sign) and returns the corresponding number. Returns 0 if the
    conversion fails.
    
        "123".oct #=> 83
        "-377".oct #=> -255
        "bad".oct #=> 0
        "0377bad".oct #=> 255
    
    If `str` starts with `0`, radix indicators are honored. See
    Kernel#Integer.