On Jan 16, 2006, at 7:50 AM, Tom Allison wrote:
> For some reason I can't get my installation of Ruby to do what the  
> examples show:
> >> 6.lcm 7
> NoMethodError: undefined method `lcm' for 6:Fixnum
>         from (irb):17
>         from :0
> >> 6.lcm(7)
> NoMethodError: undefined method `lcm' for 6:Fixnum
>         from (irb):18
>         from :0
>
> This is too simple to get wrong?

I had never seen the #lcm method before, but I see it on ruby-doc,  
and I see it in my local ri, and it also doesn't really exist for me.  
Very odd. Looks like for some reason the documentation is wrong.

Slim:~ gavinkistner$ irb --version
irb 0.9.5(05/04/13)
Slim:~ gavinkistner$ irb
irb(main):001:0> VERSION
=> "1.8.4"
irb(main):002:0> 6.respond_to? :lcm
=> false
irb(main):003:0> 6.methods.sort
=> ["%", "&", "*", "**", "+", "+@", "-", "-@", "/", "<", "<<", "<=",  
"<=>", "==", "===", "=~", ">", ">=", ">>", "[]", "^", "__id__",  
"__send__", "abs", "between?", "ceil", "chr", "class", "clone",  
"coerce", "display", "div", "divmod", "downto", "dup", "eql?",  
"equal?", "extend", "floor", "freeze", "frozen?", "hash", "id",  
"id2name", "inspect", "instance_eval", "instance_of?",  
"instance_variable_get", "instance_variable_set",  
"instance_variables", "integer?", "is_a?", "kind_of?", "method",  
"methods", "modulo", "next", "nil?", "nonzero?", "object_id", "prec",  
"prec_f", "prec_i", "private_methods", "protected_methods",  
"public_methods", "quo", "remainder", "respond_to?", "round", "send",  
"singleton_method_added", "singleton_methods", "size", "step",  
"succ", "taint", "tainted?", "times", "to_a", "to_f", "to_i",  
"to_int", "to_s", "to_sym", "truncate", "type", "untaint", "upto",  
"zero?", "|", "~"]
irb(main):004:0> quit
Slim:~ gavinkistner$ ri lcm
------------------------------------------------------------ Integer#lcm
      lcm(other)
------------------------------------------------------------------------
      Returns the lowest common multiple (LCM) of the two arguments
      (self and other).

      Examples:

        6.lcm 7        # -> 42
        6.lcm 9        # -> 18