adequate_exposure 0.5.0 → 0.6.0

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
- SHA1:
3
- metadata.gz: b45371ec2f76686959ecea9daafa48bfdcbff365
4
- data.tar.gz: 7b9d2f20e7b8817d26aa546cfa540f40cc9bd9e0
2
+ SHA256:
3
+ metadata.gz: ce17b7d2fd63e184f9b47eb20d8861407be033749995520b86a435e728c3818b
4
+ data.tar.gz: 9b430ad3d8bba9e410d44716dd512ca918215dc9c605342a040c7bfc31b18fe2
5
5
  SHA512:
6
- metadata.gz: 7b5a55b1ed6f423981c3a8763da33f5b753f463ef1f95e0c3057f01b72fc77b1a5cd0b9b8c501c28c8ab9279b77df637bf9ecaf6e01676b18e8716063cf4d9b6
7
- data.tar.gz: 94fc24e721c06a468fec3a88371b625d7ea7325b7f4c3ea3892bea709b92098ffb8432754a07f9c39f5fcad97610cfce0760976b45e06ccc2db8a5607ee7a99d
6
+ metadata.gz: 1c3c3ec85721257b46b10aa88a2260fc28a5901fb6e8245a0d9a51846bcccdff6dc8a6950813f82e30a97a3a18efcf933ecc791b6feb3d756e44754bca22d548
7
+ data.tar.gz: 5574c4f8578bc4a6ea7ec96d19c5f70e9da6380880f97ff61f5153e29d35e8e2461ab4599e5f4de80fb015b66e64860e47fb9d333befb185302cd89fe907c342
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ tmp
22
22
  *.a
23
23
  mkmf.log
24
24
  gemfiles/*.lock
25
+ .tool-versions
@@ -1,21 +1,22 @@
1
- before_install:
2
- - gem install bundler
3
-
4
1
  gemfile:
5
- - gemfiles/rails_4.0.gemfile
6
- - gemfiles/rails_4.1.gemfile
7
- - gemfiles/rails_4.2.gemfile
8
2
  - gemfiles/rails_5.0.gemfile
3
+ - gemfiles/rails_5.1.gemfile
4
+ - gemfiles/rails_5.2.gemfile
5
+ - gemfiles/rails_6.0.gemfile
9
6
 
10
7
  rvm:
11
- - 2.0
12
- - 2.1
13
8
  - 2.2
14
9
  - 2.3
10
+ - 2.4
11
+ - 2.5
15
12
 
16
13
  matrix:
17
14
  exclude:
18
- - rvm: 2.0
19
- gemfile: gemfiles/rails_5.0.gemfile
20
- - rvm: 2.1
21
- gemfile: gemfiles/rails_5.0.gemfile
15
+ - rvm: 2.2
16
+ gemfile: gemfiles/rails_6.0.gemfile
17
+ - rvm: 2.2
18
+ gemfile: gemfiles/rails_5.2.gemfile
19
+ - rvm: 2.3
20
+ gemfile: gemfiles/rails_6.0.gemfile
21
+ - rvm: 2.4
22
+ gemfile: gemfiles/rails_6.0.gemfile
data/Appraisals CHANGED
@@ -1,20 +1,19 @@
1
- appraise "rails-5.0" do
2
- gem "railties", "~> 5.0.0"
3
- gem "activesupport", "~> 5.0.0"
1
+ appraise "rails-6.0" do
2
+ gem "railties", "~> 6.0.0"
3
+ gem "activesupport", "~> 6.0.0"
4
4
  end
5
5
 
6
- appraise "rails-4.2" do
7
- gem "railties", "~> 4.2.0"
8
- gem "activesupport", "~> 4.2.0"
6
+ appraise "rails-5.2" do
7
+ gem "railties", "~> 5.2.0"
8
+ gem "activesupport", "~> 5.2.0"
9
9
  end
10
10
 
11
- appraise "rails-4.1" do
12
- gem "railties", "~> 4.1.0"
13
- gem "activesupport", "~> 4.1.0"
11
+ appraise "rails-5.1" do
12
+ gem "railties", "~> 5.1.0"
13
+ gem "activesupport", "~> 5.1.0"
14
14
  end
15
15
 
16
- appraise "rails-4.0" do
17
- gem "railties", "~> 4.0.0"
18
- gem "activesupport", "~> 4.0.0"
16
+ appraise "rails-5.0" do
17
+ gem "railties", "~> 5.0.0"
18
+ gem "activesupport", "~> 5.0.0"
19
19
  end
20
-
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "appraisal", "~> 2.1"
6
- gem "pry", "~> 0.10"
7
- gem "rake", "~> 10.3"
8
- gem "rspec-rails", "~> 3.4"
5
+ gem "appraisal", "~> 2.2"
6
+ gem "pry", "~> 0.12"
7
+ gem "rake", "~> 13.0"
8
+ gem "rspec-rails", "~> 3.9"
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Adequate Exposure
2
2
  [![Gem Version](https://img.shields.io/gem/v/adequate_exposure.svg)](https://rubygems.org/gems/adequate_exposure)
3
3
  [![Build Status](https://img.shields.io/travis/rwz/adequate_exposure.svg)](http://travis-ci.org/rwz/adequate_exposure)
4
- [![Code Climate](https://img.shields.io/codeclimate/github/rwz/adequate_exposure.svg)](https://codeclimate.com/github/rwz/adequate_exposure)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/50f8fdfcb0cf57ea3798/maintainability)](https://codeclimate.com/github/rwz/adequate_exposure/maintainability)
5
5
 
6
6
  Exposing things, adequately.
7
7
 
@@ -36,7 +36,7 @@ instance variable.
36
36
 
37
37
  ## Example Controller
38
38
 
39
- Here's what a standard Rails 4 CRUD controller using Adequate Exposure might look like:
39
+ Here's what a standard Rails 6 CRUD controller using Adequate Exposure might look like:
40
40
 
41
41
  ```ruby
42
42
  class ThingsController < ApplicationController
@@ -160,7 +160,7 @@ with less code:
160
160
 
161
161
  ```ruby
162
162
  expose :comments, from: :post
163
- # equivalent to
163
+ # equivalent to
164
164
  expose :comments, ->{ post.comments }
165
165
  ```
166
166
 
@@ -199,7 +199,7 @@ expose :thing, id: ->{ params[:try_this_id] || params[:or_maybe_that_id] }
199
199
  ### `find`
200
200
 
201
201
  If an ID was provided, Adequate Exposure will try to find the model using it.
202
- Default behavior could be expressed with this configuration:
202
+ Default behavior could be expressed with this configuration:
203
203
 
204
204
  ```ruby
205
205
  expose :thing, find: ->(id, scope){ scope.find(id) }
@@ -12,8 +12,8 @@ Gem::Specification.new do |spec|
12
12
  spec.test_files = spec.files.grep(/\Aspec\//)
13
13
  spec.require_path = "lib"
14
14
 
15
- spec.required_ruby_version = "~> 2.0"
15
+ spec.required_ruby_version = ">= 2.0"
16
16
 
17
- spec.add_dependency "railties", ">= 4.0", "< 6"
18
- spec.add_dependency "activesupport", ">= 4.0", "< 6"
17
+ spec.add_dependency "railties", ">= 5.0", "< 7"
18
+ spec.add_dependency "activesupport", ">= 5.0", "< 7"
19
19
  end
@@ -5,8 +5,8 @@ source "https://rubygems.org"
5
5
  gem "appraisal", "~> 2.1"
6
6
  gem "pry", "~> 0.10"
7
7
  gem "rake", "~> 10.3"
8
- gem "rspec-rails", "~> 3.4"
8
+ gem "rspec-rails", "~> 3.9"
9
9
  gem "railties", "~> 5.0.0"
10
10
  gem "activesupport", "~> 5.0.0"
11
11
 
12
- gemspec :path => "../"
12
+ gemspec path: "../"
@@ -5,8 +5,8 @@ source "https://rubygems.org"
5
5
  gem "appraisal", "~> 2.1"
6
6
  gem "pry", "~> 0.10"
7
7
  gem "rake", "~> 10.3"
8
- gem "rspec-rails", "~> 3.4"
9
- gem "railties", "~> 4.0.0"
10
- gem "activesupport", "~> 4.0.0"
8
+ gem "rspec-rails", "~> 3.9"
9
+ gem "railties", "~> 5.1.0"
10
+ gem "activesupport", "~> 5.1.0"
11
11
 
12
- gemspec :path => "../"
12
+ gemspec path: "../"
@@ -5,8 +5,8 @@ source "https://rubygems.org"
5
5
  gem "appraisal", "~> 2.1"
6
6
  gem "pry", "~> 0.10"
7
7
  gem "rake", "~> 10.3"
8
- gem "rspec-rails", "~> 3.4"
9
- gem "railties", "~> 4.1.0"
10
- gem "activesupport", "~> 4.1.0"
8
+ gem "rspec-rails", "~> 3.9"
9
+ gem "railties", "~> 5.2.0"
10
+ gem "activesupport", "~> 5.2.0"
11
11
 
12
- gemspec :path => "../"
12
+ gemspec path: "../"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.2"
6
+ gem "pry", "~> 0.12"
7
+ gem "rake", "~> 12.0"
8
+ gem "rspec-rails", "~> 3.9"
9
+ gem "railties", "~> 6.0.0"
10
+ gem "activesupport", "~> 6.0.0"
11
+
12
+ gemspec path: "../"
@@ -17,8 +17,8 @@ module AdequateExposure
17
17
  #
18
18
  # Returns the helper methods that are now defined on the class
19
19
  # where this method is included.
20
- def expose(*args, &block)
21
- Exposure.expose! self, *args, &block
20
+ def expose(*args, **options, &block)
21
+ Exposure.expose! self, *args, **options, &block
22
22
  end
23
23
 
24
24
  # Public: Exposes an attribute to a controller Class.
@@ -9,12 +9,13 @@ module AdequateExposure
9
9
  #
10
10
  # *args - An Array of all parameters for the new Exposure. See
11
11
  # #initialize.
12
+ # **args - A Hash of options. See #initialize.
12
13
  # block - If supplied, the exposed attribute method executes
13
14
  # the Proc when called.
14
15
  #
15
16
  # Returns a collection of exposed helper methods.
16
- def self.expose!(*args, &block)
17
- new(*args, &block).expose!
17
+ def self.expose!(*args, **options, &block)
18
+ new(*args, **options, &block).expose!
18
19
  end
19
20
 
20
21
  # Public: Initalize an Exposure with a hash of options.
@@ -1,3 +1,3 @@
1
1
  module AdequateExposure
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -23,8 +23,8 @@ describe AdequateExposure::Controller do
23
23
  before{ allow(controller).to receive(:request){ request } }
24
24
 
25
25
  %w[expose expose! exposure_config].each do |method_name|
26
- define_method method_name do |*args, &block|
27
- controller_klass.send method_name, *args, &block
26
+ define_method method_name do |*args, **keyword_args, &block|
27
+ controller_klass.public_send method_name, *args, **keyword_args, &block
28
28
  end
29
29
  end
30
30
 
@@ -9,11 +9,11 @@ describe BirdsController, type: :controller do
9
9
  after{ expect(controller.bird).to eq(mockingbird) }
10
10
 
11
11
  it "finds model by id" do
12
- get :show, id: "mockingbird"
12
+ get :show, params: { id: "mockingbird" }
13
13
  end
14
14
 
15
15
  it "finds model by bird_id" do
16
- get :show, bird_id: "mockingbird"
16
+ get :show, params: { bird_id: "mockingbird" }
17
17
  end
18
18
  end
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adequate_exposure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pravosud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-02 00:00:00.000000000 Z
11
+ date: 2020-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6'
22
+ version: '7'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.0'
29
+ version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6'
32
+ version: '7'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '4.0'
39
+ version: '5.0'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '6'
42
+ version: '7'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '4.0'
49
+ version: '5.0'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '6'
52
+ version: '7'
53
53
  description:
54
54
  email:
55
55
  - pavel@pravosud.com
@@ -65,10 +65,10 @@ files:
65
65
  - README.md
66
66
  - Rakefile
67
67
  - adequate_exposure.gemspec
68
- - gemfiles/rails_4.0.gemfile
69
- - gemfiles/rails_4.1.gemfile
70
- - gemfiles/rails_4.2.gemfile
71
68
  - gemfiles/rails_5.0.gemfile
69
+ - gemfiles/rails_5.1.gemfile
70
+ - gemfiles/rails_5.2.gemfile
71
+ - gemfiles/rails_6.0.gemfile
72
72
  - lib/adequate_exposure.rb
73
73
  - lib/adequate_exposure/attribute.rb
74
74
  - lib/adequate_exposure/behavior.rb
@@ -91,7 +91,7 @@ require_paths:
91
91
  - lib
92
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2.0'
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -100,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubyforge_project:
104
- rubygems_version: 2.6.4
103
+ rubygems_version: 3.1.2
105
104
  signing_key:
106
105
  specification_version: 4
107
106
  summary: Exposing things, adequately
@@ -1,12 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal", "~> 2.1"
6
- gem "pry", "~> 0.10"
7
- gem "rake", "~> 10.3"
8
- gem "rspec-rails", "~> 3.4"
9
- gem "railties", "~> 4.2.0"
10
- gem "activesupport", "~> 4.2.0"
11
-
12
- gemspec :path => "../"