Array#abbrev depreciated?

J

Jason Lillywhite

If you look at the core ruby doc, it says Array#abbrev will let you do
this:

%w{ car cone }.abbrev #=> { "ca" => "car", "car" => "car",
"co" => "cone", "con" => cone",
"cone" => "cone" }

But if I try this in IRB, I get:

irb(main):002:0> %w{ car cone }.abbrev
NoMethodError: undefined method `abbrev' for ["car", "cone"]:Array
from (irb):2

Is Array#abbrev depreciated?
 
T

Tim Hunter

Jason said:
If you look at the core ruby doc, it says Array#abbrev will let you do
this:

%w{ car cone }.abbrev #=> { "ca" => "car", "car" => "car",
"co" => "cone", "con" => cone",
"cone" => "cone" }

But if I try this in IRB, I get:

irb(main):002:0> %w{ car cone }.abbrev
NoMethodError: undefined method `abbrev' for ["car", "cone"]:Array
from (irb):2

Is Array#abbrev depreciated?

require 'abbrev'
 
J

Joel VanderWerf

Jason said:
If you look at the core ruby doc, it says Array#abbrev will let you do
this:

%w{ car cone }.abbrev #=> { "ca" => "car", "car" => "car",
"co" => "cone", "con" => cone",
"cone" => "cone" }

But if I try this in IRB, I get:

irb(main):002:0> %w{ car cone }.abbrev
NoMethodError: undefined method `abbrev' for ["car", "cone"]:Array
from (irb):2

Is Array#abbrev depreciated?

require 'abbrev' # it's in the stdlib, not core
 
7

7stud --

Jason said:
Is Array#abbrev depreciated?

Yes, ruby changed accountants, and the new accountants have decided to
depreciate abbrev over the next five years for a tax write off.
 
J

Jason Lillywhite

Tim said:
require 'abbrev'

I didn't realize that a class from the core library would have methods
from the standard library. I know ruby classes can be extended, but I
just didn't expect it here.

Thanks!
 
J

Jason Lillywhite

7stud said:
Yes, ruby changed accountants, and the new accountants have decided to
depreciate abbrev over the next five years for a tax write off.

oops. Deprecated. You can tell I'm new at this. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top