active_record-ingress 0.1.0 → 0.2.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: 44f2df474320f208c7c2070f366716be97f2057418055d80c54977524c4ca03d
4
- data.tar.gz: 98540cb40ca317ddcd15cb9a6a73fa1ee922c286f0cb314c5d9dd0f4a550c38f
3
+ metadata.gz: 32c4506e99cbf7645054306b1be5573f37ac6adbe517ea72895d9fa7f614b6f1
4
+ data.tar.gz: 9156ee99f0847c24ac0dd38d279cbb2f45686cec85623fd292ec39a074e39623
5
5
  SHA512:
6
- metadata.gz: b39a3673edd55b026c911eb400e065de09e0505fc6a06e48bb289dcc37b947bbc1569a3a81644a0d27505bca48b52229ef389dd78087c32af2c8da5d8f5f86da
7
- data.tar.gz: be2eeb6bb12243b606712df38f76995fed25db05082d9301b14c6e2447b445c854070dc00be0159b3707666ddb6322968539d0b5acd0b02a971f2b54942bf5dd
6
+ metadata.gz: '078b9c1d9ee5c854054788aa3cf08d2e4ab24cf81c534ee2d49c3f91367b10a964f4a8dd1a6d3edf01147f31bb2bdb59a2dfce6534a9cf5648e2775cf4be9f83'
7
+ data.tar.gz: b8f16031704f6dd1fe81d8ec6b5c1b389d9aec74a587921f35c76dd8df72b39b3905207005e350eb7e35855f5023a4c3340c4a0afdf01bf31347a23314aa4c75
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2022-04-27
4
+
5
+ - Change namespace from `::Ingresses` to `::Ingressed` to mirror the `record.ingressed.x` proxy.
6
+
3
7
  ## [0.1.0] - 2022-04-27
4
8
 
5
9
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_record-ingress (0.1.0)
4
+ active_record-ingress (0.2.0)
5
5
  activerecord (>= 6.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -6,11 +6,11 @@ Pass control of Active Record methods to a dedicated object.
6
6
 
7
7
  `ActiveRecord::Ingress` adds proxy forwarding method `ingressed` to any `ActiveRecord::Base` instance.
8
8
 
9
- So `post.ingressed.update(title: "Updated title")` would look up a `Post::Ingresses::Update` class, instance and execute its `perform` method:
9
+ So `post.ingressed.update(title: "Updated title")` would look up a `Post::Ingressed::Update` class, instance and execute its `perform` method:
10
10
 
11
11
  ```ruby
12
- # app/models/post/ingresses/update.rb
13
- class Post::Ingresses::Update < ActiveRecord::Ingress::Base
12
+ # app/models/post/ingressed/update.rb
13
+ class Post::Ingressed::Update < ActiveRecord::Ingress::Base
14
14
  # Each ingress has `params`, containing any passed keyword arguments.
15
15
  # This extracts `params[:title]` and Ruby's keyword arguments handling will prevent accepting other arguments.
16
16
  def perform(title:)
@@ -22,8 +22,8 @@ end
22
22
  Ingresses can be used to create other forwarding too. Here, a `post.ingressed.prepare` is added:
23
23
 
24
24
  ```ruby
25
- # app/models/post/ingresses/prepare.rb
26
- class Post::Ingresses::Publish < ActiveRecord::Ingress::Base
25
+ # app/models/post/ingressed/prepare.rb
26
+ class Post::Ingressed::Publish < ActiveRecord::Ingress::Base
27
27
  def perform
28
28
  # Forwards to `record.transaction`
29
29
  transaction do
@@ -9,7 +9,7 @@ class ActiveRecord::Ingress::Base
9
9
  end
10
10
 
11
11
  def self.inherited(klass)
12
- if alias_name = klass.module_parent_name.chomp("::Ingresses").underscore.presence
12
+ if alias_name = klass.module_parent_name.chomp("::Ingressed").underscore.presence
13
13
  alias_method alias_name, :record
14
14
  end
15
15
  end
@@ -11,6 +11,6 @@ class ActiveRecord::Ingress::Proxy
11
11
  attr_reader :__record__
12
12
 
13
13
  def find_record_ingress_named(name)
14
- "#{__record__.class.name}::Ingresses::#{name.to_s.classify}".constantize
14
+ "#{__record__.class.name}::Ingressed::#{name.to_s.classify}".constantize
15
15
  end
16
16
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Ingress
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-ingress
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Timm Hansen