BETAmodules.com is in beta — open to partnerships & joint ventures.Build with us

filter

v0.0.6RubyGems· Ruby

== Synopsys <code>Enumerable#filter</code> - extended <code>Enumerable#select</code> == Examples String filter (acts like <code>Enumerable#grep</code>): [1, 2, 3, 'ab'].filter(/a/) # => ['ab'] [1, 2, 3, '3'].filter('3') # => ['3'] You can pass a <code>Proc</code> or <code>Symbol</code>. Methods and blocks are allowed too: [1, 2, 3].filter(&:even?) # => [2] [1, 2, 3].filter(:even?) # => [2] [1, 2, 4].filter { |num| num.even? } # => [2, 4] <code>Enumerable#filter</code> can match against enumerable items attributes. Like this: [1, 2, 3, 4.2].filter :to_i => :even? # => [2, 4] If the block is supplied, each matching element is passed to it, and the block's result is stored in the output array. [1, 2, 4].filter(&:even?) { |n| n + 1 } # => [3, 5] <code>Enumerable#filter</code> also accepts <code>true</code> or <code>false</code> as argument: [0, false, 2, nil].filter(true) # => [0, 2] [0, false, 2, nil].filter(false) # => [false, nil] <code>Enumerable#filter</code> also supports <code>OR</code> operator! Just pass many patterns, they will be joined together with <code>OR</code> operator. [0, 2, 3, 4].filter(:zero?, :odd?) # => [0, 3]

The verdict
Abandoned. Last published 14 years ago. No recent activity — look for a maintained alternative.
No recent activity — look for a maintained alternative.
Live from the RubyGems registry · derived rules, not AI
How it scores
MaintenanceAbandoned
PopularityNiche
SecurityClean
LicenseUnknown
DepsZero deps
Maintenance
Last published 14 years ago.
Popularity
9 downloads / week
Security
No known advisories for this version (OSV).
License
No license declared.
Dependencies
No runtime dependencies
Recent releases
  • 0.0.614 years ago
  • 0.0.514 years ago
  • 0.0.414 years ago
  • 0.0.314 years ago
  • 0.0.214 years ago
  • 0.0.114 years ago
filter — == Synopsys <code>Enumerable#filter</code> - extended <code>Enumerable#select</code> == Examples String filter (acts like <code>Enumerable#grep</code>): [1, 2, 3, 'ab'].filter(/a/) # => ['ab'] [1, 2, 3, '3'].filter('3') # => ['3'] You can pass a <code>Proc</code> or <code>Symbol</code>. Methods and blocks are allowed too: [1, 2, 3].filter(&:even?) # => [2] [1, 2, 3].filter(:even?) # => [2] [1, 2, 4].filter { |num| num.even? } # => [2, 4] <code>Enumerable#filter</code> can match against enumerable items attributes. Like this: [1, 2, 3, 4.2].filter :to_i => :even? # => [2, 4] If the block is supplied, each matching element is passed to it, and the block's result is stored in the output array. [1, 2, 4].filter(&:even?) { |n| n + 1 } # => [3, 5] <code>Enumerable#filter</code> also accepts <code>true</code> or <code>false</code> as argument: [0, false, 2, nil].filter(true) # => [0, 2] [0, false, 2, nil].filter(false) # => [false, nil] <code>Enumerable#filter</code> also supports <code>OR</code> operator! Just pass many patterns, they will be joined together with <code>OR</code> operator. [0, 2, 3, 4].filter(:zero?, :odd?) # => [0, 3] (Ruby / RubyGems) · Modules