Skip to content

Commit c0b3b75

Browse files
committed
Add missing ENV#{filter,filter!} aliases for select and select!.
1 parent 1a6aa8d commit c0b3b75

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ Compatibility:
1313
* Implemented `Integer#{allbits?,anybits?,nobits?}`.
1414
* `Integer#{ceil,floor,truncate}` now accept a precision and `Integer#round` accepts a rounding mode.
1515
* Added missing `Enumerable#filter` and `Enumerator::Lazy#filter` aliases to the respective `select` method (#1610).
16-
* Implement more `Ripper` methods as no-ops (#1694).
16+
* Implemented more `Ripper` methods as no-ops (#1694).
1717
* Implemented `rb_enc_sprintf` (#1702).
18+
* Implemented `ENV#{filter,filter!}` aliases for `select` and `select!`.
1819

1920
Changes:
2021

spec/tags/core/env/filter_tags.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/main/ruby/truffleruby/core/env.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved. This
3+
# Copyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved. This
44
# code is released under a tri EPL/GPL/LGPL license. You can use it,
55
# redistribute it and/or modify it under the terms of the:
66
#
@@ -245,6 +245,7 @@ def select(&blk)
245245
return to_enum { size } unless block_given?
246246
to_hash.select(&blk)
247247
end
248+
alias_method :filter, :select
248249

249250
def to_a
250251
ary = []
@@ -292,6 +293,7 @@ def select!
292293
return to_enum(:select!) { size } unless block_given?
293294
reject! { |k, v| !yield(k, v) }
294295
end
296+
alias_method :filter!, :select!
295297

296298
def assoc(key)
297299
key = StringValue(key)

0 commit comments

Comments
 (0)