Skip to content

Commit

Permalink
Avoid a mixture of Array#filter and Array#select
Browse files Browse the repository at this point in the history
Although `Array#select` is an alias of `Array#filter`, it would be clearer to use either only `filter` or `select` in the examples for readers.
  • Loading branch information
kymmt90 authored Nov 5, 2021
1 parent 9bd875c commit ea67395
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/rbs_by_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ end

```ruby
# .rb
[1,2,3,4,5].select {|num| num.even? }
[1,2,3,4,5].filter {|num| num.even? }
# => [2, 4]
%w[ a b c d e f ].select {|v| v =~ /[aeiou]/ }
%w[ a b c d e f ].filter {|v| v =~ /[aeiou]/ }
# => ["a", "e"]
[1,2,3,4,5].filter
```
Expand Down

0 comments on commit ea67395

Please sign in to comment.