power-types 0.6.0 → 0.7.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
  SHA256:
3
- metadata.gz: 4fcacd0da843b9147e8fdee88e0bee0535754df30302cac175f251aa0f1faea7
4
- data.tar.gz: e1c7423de402d32ae8488f33b101621158f8e7f521f5ced50f68680edc5cfd0d
3
+ metadata.gz: 97911d46926a1215cd7a114d6a90f8e6716a9181f0551bed8f74b8ed8718ae84
4
+ data.tar.gz: 21ca06565fb213947fa263e1e07ebe89348641413ee9d05c566cdd09b697d994
5
5
  SHA512:
6
- metadata.gz: db7acee0f6224fa46ae216bae6cf5b4d3a8eb7ff5256e830044e3c9573064605ef350a1da3b72d16e2f6b79d02b78e805e41e2a08b7155da491567cddbb7e031
7
- data.tar.gz: 908d8b3c6b592b5b0e8b0dcd0db1dd13174c7d66e8b64a20e979675c89ecbd6f3394c4f7bd0f2afe4df2db1d14905e45a139c057575eb74e1e95290e7242004c
6
+ metadata.gz: f4abc5333d3bdfb2a1f687c31a351894393191ce61806a31f58c54c3dcc561a65d86d8cd9cfdea85041b9d0f4bc091cd040b51fce8bdded07836046f653af460
7
+ data.tar.gz: 4e7a652ee31cca5e1fa70051f9934813300385a8fcfb96f29d2137cec4b38c9a6ab51b4e3026749923405dccff9a8c5c519c1fdcba1bed0b0843fbfa6a5b954b
data/.circleci/config.yml CHANGED
@@ -14,10 +14,10 @@ executors:
14
14
  parameters:
15
15
  ruby-version:
16
16
  description: "Ruby version"
17
- default: "2.7"
17
+ default: "3.2"
18
18
  type: string
19
19
  docker:
20
- - image: circleci/ruby:<<parameters.ruby-version>>-node
20
+ - image: cimg/ruby:<<parameters.ruby-version>>-node
21
21
  environment: *env-vars
22
22
 
23
23
  commands:
@@ -28,8 +28,8 @@ commands:
28
28
  - run:
29
29
  name: Install bundle dependencies
30
30
  command: |
31
- gem install bundler:2.2.15
32
- bundle install
31
+ gem install bundler:2.2.34
32
+ bundle _2.2.34_ install
33
33
 
34
34
  jobs:
35
35
  lint:
@@ -93,7 +93,7 @@ workflows:
93
93
  - test:
94
94
  matrix:
95
95
  parameters:
96
- ruby-version: ["2.5", "2.6", "2.7"]
96
+ ruby-version: ["2.5", "2.6", "2.7", "3.1", "3.2"]
97
97
  - deploy:
98
98
  context: org-global
99
99
  filters:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7
1
+ 3.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 0.7.0
4
+
5
+ Added
6
+ - Add after_destroy_commit callback [#25](https://github.com/platanus/power-types/pull/25)
7
+ - Add Ruby 3.2 support
8
+
9
+ Fixed
10
+ - Fix presenter params decoration [#26](https://github.com/platanus/power-types/pull/26)
data/README.md CHANGED
@@ -257,7 +257,7 @@ end
257
257
  ```
258
258
  Note: Triggering the event will preserve the order of the methods, so in the example `kill_villain` will be called before `bury_villains_corpse`.
259
259
 
260
- Recently we added three new callbacks, `after_create_commit`, `after_update_commit` and `after_save_commit`. With these callbacks we want to reproduce the `after_commit` transactional callback from Active Record. For this implementation we use the gem [After Commit Everywhere](https://github.com/Envek/after_commit_everywhere) to be able to use the `after_commit` callbacks outside the Active Record models.
260
+ Recently we added four new callbacks, `after_create_commit`, `after_update_commit`, `after_save_commit` and `after_destroy_commit`. With these callbacks we want to reproduce the `after_commit` transactional callback from Active Record. For this implementation we use the gem [After Commit Everywhere](https://github.com/Envek/after_commit_everywhere) to be able to use the `after_commit` callbacks outside the Active Record models.
261
261
 
262
262
  ### Values
263
263
 
@@ -296,7 +296,7 @@ To initialize a presenter inside your controller action you should execute the `
296
296
  class UsersController < InheritedResources::Base
297
297
  def show
298
298
  presenter_params = { param1: 1, param2: 2 }
299
- @presenter = present_with(:users_show, presenter_params)
299
+ @presenter = present_with(:users_show_presenter, presenter_params)
300
300
  end
301
301
  end
302
302
  ```
@@ -317,7 +317,7 @@ You can access `presenter_params` inside the presenter as an `attr_reader`
317
317
  class UsersController < InheritedResources::Base
318
318
  def show
319
319
  presenter_params = { platanus_url: "https://platan.us" }
320
- @presenter = present_with(:users_show, presenter_params)
320
+ @presenter = present_with(:users_show_presenter, presenter_params)
321
321
  end
322
322
  end
323
323
  ```
@@ -336,7 +336,7 @@ If the presenter param has a [decorator](https://github.com/drapergem/draper), t
336
336
  class UsersController < InheritedResources::Base
337
337
  def show
338
338
  presenter_params = { user: user }
339
- @presenter = present_with(:users_show, presenter_params)
339
+ @presenter = present_with(:users_show_presenter, presenter_params)
340
340
  end
341
341
 
342
342
  private
@@ -20,9 +20,9 @@ module PowerTypes
20
20
  attr_reader :h
21
21
 
22
22
  def decorated_value(value)
23
- return value unless value.respond_to?(:decorate)
24
-
25
23
  value.decorate
24
+ rescue NameError
25
+ value
26
26
  end
27
27
  end
28
28
  end
@@ -1,7 +1,8 @@
1
1
  module PowerTypes
2
2
  module Util
3
3
  OBSERVABLE_EVENTS = [:create, :update, :save, :destroy]
4
- OBSERVABLE_TRANSACTIONAL_EVENTS = [:create_commit, :update_commit, :save_commit]
4
+ OBSERVABLE_TRANSACTIONAL_EVENTS = [:create_commit, :update_commit, :save_commit,
5
+ :destroy_commit]
5
6
  OBSERVABLE_TYPES = [:before, :after]
6
7
  end
7
8
  end
@@ -1,3 +1,3 @@
1
1
  module PowerTypes
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-09-09 00:00:00.000000000 Z
12
+ date: 2023-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -200,6 +200,7 @@ files:
200
200
  - ".rspec"
201
201
  - ".rubocop.yml"
202
202
  - ".ruby-version"
203
+ - CHANGELOG.md
203
204
  - CODE_OF_CONDUCT.md
204
205
  - Gemfile
205
206
  - Guardfile
@@ -255,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
256
  - !ruby/object:Gem::Version
256
257
  version: '0'
257
258
  requirements: []
258
- rubygems_version: 3.1.6
259
+ rubygems_version: 3.4.10
259
260
  signing_key:
260
261
  specification_version: 4
261
262
  summary: Power Types for Rails by Platanus