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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7357a934edea8da3fad3521e262b325f5a074aa2
4
- data.tar.gz: 3314c60c18cfe8712cc6554dd30d3ab439320264
3
+ metadata.gz: '008d26bbd4350a53113ea397507d127e219f0220'
4
+ data.tar.gz: 7e4e0a68c9c7a4adf3fc9065339be324529cea65
5
5
  SHA512:
6
- metadata.gz: 36b5426bae95cac10e625fc75fcf5e6c6d84c383808f7fefeb638e255bb6126448db590c85a1a4300181da78ae3b7343db912dbc6704784b612601955fc6e977
7
- data.tar.gz: 31bdeb20fa5b6759fd6d007ccab67d96fd4f587dc131fc4f5e043391710d1a48fcab00edbb48754d9bf60c2e7c6700fec74d9381c9ac8da68f6c2086acd00706
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.
@@ -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
- delete_if do |k, v|
11
- key.to_s == k.to_s && !Array(val).include?(v)
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Add #allow, #allow!, #forbid, and #forbid! to Hash
2
4
  class Hash
3
5
  include Forbidium
@@ -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
- delete_if do |k, v|
11
- key.to_s == k.to_s && Array(val).include?(v)
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
@@ -22,6 +22,6 @@ require 'forbidium/forbid'
22
22
  # hash # => {}
23
23
  module Forbidium
24
24
  def self.included(base)
25
- [Forbidium::Allow, Forbidium::Forbid].each { |mod| base.include mod }
25
+ [Forbidium::Allow, Forbidium::Forbid].each { |mod| base.send :include, mod }
26
26
  end
27
27
  end
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Forbidium
2
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.0.1'
3
5
  end
data/lib/forbidium.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'forbidium/version'
2
4
  require 'forbidium/forbidium'
3
5
  require 'forbidium/core_ext/hash'
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.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: '0'
69
+ version: 2.0.0
84
70
  required_rubygems_version: !ruby/object:Gem::Requirement
85
71
  requirements:
86
72
  - - ">="