allowable 1.0.1 → 1.0.2

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: c7e7da4c70fd54817bca842112986bb5fcd446f6
4
- data.tar.gz: a638a8e7dc12fe4bea15b4c57d00c83edb848a34
3
+ metadata.gz: 9a158170af78796338bf4cf75bf5e4e2ec58c52d
4
+ data.tar.gz: 61fed37bc38d0175c977c7e18054a45fb3ad671f
5
5
  SHA512:
6
- metadata.gz: 12650f5fc1ee1ba2c45631bb339f3aed17f5d5fcc4d400c11a91796648a896f5f49058f353f961e78a7907dd2a21ce6a1d61a7c2d08b12ba1d9a9f68da7295e9
7
- data.tar.gz: 8421cdf89fb210b2c8507539a37632c57afff65eb32eb52edc3573136d9548f3453c55646554a04a0dfbd9b1305338d182e4af6340928f1e614e900d18b0ef76
6
+ metadata.gz: 932e5d6d255a5cadab770b07c1a9500316ce9ad75ee55386fe96c62de631c15ce5d2611c1ff3a0f50850355bd3f029b25483cc98cd7555e5e3aa2243081ff9ea
7
+ data.tar.gz: 279294123d8af70b000b5be1576a5e2f710d278f6b82cf779574fb69a9d8f66ca75efbae42469bf0664a3dcdc654afbbe2358b718bf58af51ab513729c800415
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # Changelog
2
+ 1.0.2
3
+ -----
4
+ * Match array values e.g. `{ key: ['val_one', 'val_two'] }.forbid(key: ['val_one', 'val_two']) # => {}` TODO: Slows down benchmarked performance of `#allow`, need to figure out why
5
+
2
6
  1.0.1
3
7
  -----
4
8
  * Relax Ruby version restriction. Core module should work with any Ruby. Rails < 4.2.0 may experience issues initializing the plugin.
data/README.md CHANGED
@@ -41,6 +41,10 @@ hash.allow!(one: 'two') # => { two: 'two' }
41
41
  hash.forbid!(two: 'two') # => {}
42
42
 
43
43
  hash # => {}
44
+
45
+ hash.merge(one: ['one', 1]) # => { one: ["one", 1], two: "two" }
46
+
47
+ hash.merge(one: ['one', 1]).forbid(one: ['one', 1]) # => { two: "two" }
44
48
  ```
45
49
 
46
50
  #### Type sensitive for `Hash`
@@ -9,7 +9,7 @@ module Allowable
9
9
 
10
10
  def allow!(filters = {})
11
11
  filters.each do |key, val|
12
- delete(key) unless Array(val).include?(self[key])
12
+ delete(key) unless Array(val).include?(self[key]) || val == self[key]
13
13
  end
14
14
  self
15
15
  end
@@ -9,7 +9,7 @@ module Allowable
9
9
 
10
10
  def forbid!(filters = {})
11
11
  filters.each do |key, val|
12
- delete(key) if Array(val).include?(self[key])
12
+ delete(key) if Array(val).include?(self[key]) || val == self[key]
13
13
  end
14
14
  self
15
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Allowable
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allowable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Simon Borg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-03 00:00:00.000000000 Z
11
+ date: 2017-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler