forbidium 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/forbidium/allow.rb +4 -3
- data/lib/forbidium/core_ext/hash.rb +2 -0
- data/lib/forbidium/forbid.rb +4 -3
- data/lib/forbidium/forbidium.rb +1 -1
- data/lib/forbidium/railtie.rb +3 -1
- data/lib/forbidium/version.rb +3 -1
- data/lib/forbidium.rb +2 -0
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '008d26bbd4350a53113ea397507d127e219f0220'
|
4
|
+
data.tar.gz: 7e4e0a68c9c7a4adf3fc9065339be324529cea65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e05dd2083cb2325b6808ffdbf63748beacaf55c211eb2332e084ee72591429799e7d80a0e0eab957b5ad1695cb70dd916b34c25ee12d3ada58b0d19bc00f4c4
|
7
|
+
data.tar.gz: 15ce9fe7cf6407b9f2066051cf05c3481fb90782ca8de0411a95d3b781e50070b56e676d4c2bc89a09fd7e2b9138433f18e725c8d42eca4cbbb3c47b080072d8
|
data/README.md
CHANGED
@@ -36,6 +36,20 @@ hash.forbid!(two: 'two') # => {}
|
|
36
36
|
|
37
37
|
hash # => {}
|
38
38
|
```
|
39
|
+
|
40
|
+
## Platform support
|
41
|
+
|
42
|
+
Tested against:
|
43
|
+
* MRI 2.0.0
|
44
|
+
* MRI 2.1.10
|
45
|
+
* MRI 2.2.5
|
46
|
+
* MRI 2.3.0
|
47
|
+
* MRI 2.3.4
|
48
|
+
* MRI 2.4.1
|
49
|
+
* JRuby 9.1.6.0
|
50
|
+
* JRuby HEAD
|
51
|
+
* MRI HEAD
|
52
|
+
|
39
53
|
## Development
|
40
54
|
|
41
55
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/forbidium/allow.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Forbidium
|
2
4
|
# Adds the #allow and #allow! methods
|
3
5
|
module Allow
|
@@ -7,9 +9,8 @@ module Forbidium
|
|
7
9
|
|
8
10
|
def allow!(filters = {})
|
9
11
|
filters.each do |key, val|
|
10
|
-
|
11
|
-
|
12
|
-
end
|
12
|
+
delete(key) unless Array(val).include?(self[key])
|
13
|
+
delete(key.to_s) unless Array(val).include?(self[key.to_s])
|
13
14
|
end
|
14
15
|
self
|
15
16
|
end
|
data/lib/forbidium/forbid.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Forbidium
|
2
4
|
# Adds the #forbid and #forbid! methods
|
3
5
|
module Forbid
|
@@ -7,9 +9,8 @@ module Forbidium
|
|
7
9
|
|
8
10
|
def forbid!(filters = {})
|
9
11
|
filters.each do |key, val|
|
10
|
-
|
11
|
-
|
12
|
-
end
|
12
|
+
delete(key) if Array(val).include?(self[key])
|
13
|
+
delete(key.to_s) if Array(val).include?(self[key.to_s])
|
13
14
|
end
|
14
15
|
self
|
15
16
|
end
|
data/lib/forbidium/forbidium.rb
CHANGED
data/lib/forbidium/railtie.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails/railtie'
|
2
4
|
|
3
5
|
module Forbidium
|
@@ -5,7 +7,7 @@ module Forbidium
|
|
5
7
|
class Railtie < ::Rails::Railtie
|
6
8
|
initializer :forbidium do
|
7
9
|
ActiveSupport.on_load :action_controller do
|
8
|
-
ActionController::Parameters.include Forbidium
|
10
|
+
ActionController::Parameters.send :include, Forbidium
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
data/lib/forbidium/version.rb
CHANGED
data/lib/forbidium.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forbidium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- M. Simon Borg
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
41
|
description: Filter hash keys based on allowed and forbidden values.
|
56
42
|
email:
|
57
43
|
- msimonborg@gmail.com
|
@@ -80,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
66
|
requirements:
|
81
67
|
- - ">="
|
82
68
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
69
|
+
version: 2.0.0
|
84
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
71
|
requirements:
|
86
72
|
- - ">="
|