Project

General

Profile

Actions

Bug #15441

closed

undefined method `union' and `difference' in Ruby 2.6

Added by ana06 (Ana Maria Martinez Gomez) over 5 years ago. Updated over 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
2.6
[ruby-core:90632]

Description

Using irb with using current Ruby trunk version:

irb(main):008:0> RUBY_VERSION
=> "2.6.0"
irb(main):009:0> [1,3,5,7,9].union([2,3,4,5,6])
Traceback (most recent call last):
        2: from /usr/local/bin/irb:11:in `<main>'
        1: from (irb):9
NoMethodError (undefined method `union' for [1, 3, 5, 7, 9]:Array)

irb(main):002:0> [1,2,3,4].difference([1,2])
Traceback (most recent call last):
        2: from /usr/local/bin/irb:11:in `<main>'
        1: from (irb):2
NoMethodError (undefined method `difference' for [1, 2, 3, 4]:Array)

Updated by Hanmac (Hans Mackowiak) over 5 years ago

@ana06 (Ana Maria Martinez Gomez) what is your build day or revision number?

because this methods where added with #14097 3 months ago

Updated by hsbt (Hiroshi SHIBATA) over 5 years ago

  • Status changed from Open to Rejected

Please use the latest revision of Ruby 2.6.

~ > ruby -v
ruby 2.6.0dev (2018-12-20 trunk 66456) +JIT [x86_64-darwin18]
~ > irb
>> [1,3,5,7,9].union([2,3,4,5,6])
=> [1, 3, 5, 7, 9, 2, 4, 6]

Updated by ana06 (Ana Maria Martinez Gomez) over 5 years ago

I have just downloaded trunk again and it seems to work now... Maybe there was some related changes or maybe I didn't have the current version and I though I had

Anyway, it seems fixed, sorry for the mess

Updated by shevegen (Robert A. Heiler) over 5 years ago

"ruby -v" probably provides more information than the in-ruby
constant RUBY_VERSION alone does.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0