duck_puncher 2.12.1 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e0baa8b465ab3c4158735e6bc53c37f0bbf6883
4
- data.tar.gz: 34c8cf5c21031da525db6133dbec50e3d4840f26
3
+ metadata.gz: 2bd0730996e1455c059a2357503204895c4b4106
4
+ data.tar.gz: e21eca26c8bd137164357e6978b234fd927bf768
5
5
  SHA512:
6
- metadata.gz: 202f6cc91ff336089c3761334add4ab4503bd358fef5aa9310fb555545a3b980701ef8db4504b3af75207baa1871956365e1c4dd6cfc1a09c3ad85ee0a8dc136
7
- data.tar.gz: 8f431ff2ca0ecd65c040842d803edb06012baf39c90d0a806f32c42bed21b57a4677b249659abd5401a0a7d166e74a0e110ac4789a58cf48f7302e16610f0b51
6
+ metadata.gz: 812763952014159ac97bce9d7eabe39cfb89f1957a1e9ec081f263151d40acbc3d5176f50a9b42964f9abcb69563f239747bfa20411d556cad53bb14ce2aaa1d
7
+ data.tar.gz: 364d76cc5f8d900f2fbea362f8876251e0453504da3ef8423f2024edc36955f4cde85d43b865121d9b0a4659b3009bcbbd30fea3faff679661f3590be9a78b47
data/README.md CHANGED
@@ -12,6 +12,7 @@ Default extensions:
12
12
  Array #m => `[].m(:to_s)` => `[].map(&:to_s)`
13
13
  #mm => `[].mm(:sub, /[aeiou]/, '*')` => `[].map { |x| x.sub(/[aeiou]/, '*') }`
14
14
  #get => `[].methods.get('ty?')` => [:empty?]
15
+ #except => `[].except('foo', 'bar')` => `[] - ['foo', 'bar']`
15
16
  Hash #dig => `{a: 1, b: {c: 2}}.dig(:b, :c)` => 2 (Part of standard lib in Ruby >= 2.3)
16
17
  Numeric #to_currency => `25.245.to_currency` => 25.25
17
18
  #to_duration => `10_000.to_duration` => '2 h 46 min'
@@ -13,6 +13,10 @@ module DuckPuncher
13
13
  regex = regex_or_str.is_a?(Regexp) ? regex_or_str : Regexp.new(Regexp.escape(regex_or_str))
14
14
  select { |x| x.to_s =~ regex }
15
15
  end
16
+
17
+ def except(*args)
18
+ self - args
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -1,3 +1,3 @@
1
1
  module DuckPuncher
2
- VERSION = '2.12.1'.freeze
2
+ VERSION = '2.13.0'.freeze
3
3
  end
@@ -25,4 +25,10 @@ class ArrayTest < MiniTest::Test
25
25
  assert_equal [].methods.punch.get(/ty\?/), [:empty?]
26
26
  assert_equal [].methods.punch.get('ty?'), [:empty?]
27
27
  end
28
+
29
+ def test_except
30
+ assert_equal subject.except('a'), %w[b c d e f g h i j k l m]
31
+ assert_equal subject.except('a', 'b', 'c'), %w[d e f g h i j k l m]
32
+ assert_equal subject.except, subject
33
+ end
28
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duck_puncher
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Buckley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-01 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: usable