orthoses-paranoia 0.1.0 → 1.0.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
2
  SHA256:
3
- metadata.gz: 17021bf453e971f9680729d7bc31e518010ef1a63a2f37c892f6503d1261e59d
4
- data.tar.gz: d2ee4b7582c7a6458d2b508890ea69858acf4d58aad3c3e73742c2bf1f28a82d
3
+ metadata.gz: 852e0761300eb8fb7947b9b5000bc2c8e8134ea024f84efbe1d091462facb919
4
+ data.tar.gz: 8eb24f19ad182007e5053980fc73bf462ec639f519790a6256766c01d8da88b5
5
5
  SHA512:
6
- metadata.gz: 1bdf31889f848a5546877d53d1e13dbd12eb623b867797a79935ff14ea81c9e75eb62a8f5ed559d3dc86459706c14fea13918c2d1d040205ec6f40eedfd54cef
7
- data.tar.gz: 0c95d6ee077313c43bf88076a716016c1b6d362d268aa6b4cffa96ae12ad46ca996396185a0f379e3df939e921ba7bbc397d7ae0481f783638c191616e39d0dd
6
+ metadata.gz: fd75d77a629aef7cde60bc27e513fae026b497875f4aae6d5219996bd607d186a592bb22ba4db95cc565d406fc78f662605f91e5c098c405a55cc9b6af48e4f1
7
+ data.tar.gz: 7dd7874ef7d14d5a94e6c672d097e887c32098b2fddf21d8dbdda9e8b52c1d15d0dab51b10963b0336967003ef7b2233c17d175ae9d4bdae7962919f6325dd5d
data/README.md CHANGED
@@ -5,22 +5,21 @@ Orthoses::Paranoia automatically generates RBS for methods added by Paranoia.
5
5
 
6
6
  ```rb
7
7
  User.with_deleted #=> User::ActiveRecord_Relation
8
+ User.first.deleted? #=> bool
8
9
  ```
9
10
 
10
11
  ## Installation
11
12
 
12
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
13
-
14
13
  Install the gem and add to the application's Gemfile by executing:
15
14
 
16
15
  ```bash
17
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
16
+ bundle add orthoses-paranoia
18
17
  ```
19
18
 
20
19
  If bundler is not being used to manage dependencies, install the gem by executing:
21
20
 
22
21
  ```bash
23
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
22
+ gem install orthoses-paranoia
24
23
  ```
25
24
 
26
25
  ## Usage
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Orthoses
4
4
  class Paranoia
5
- VERSION = "0.1.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -17,17 +17,16 @@ module Orthoses
17
17
 
18
18
  acts_as_paranoid.captures.each do |capture|
19
19
  base_name = Utils.module_name(capture.method.receiver) or next
20
- paranoia_class_methods = "#{base_name}::ParanoiaClassMethods"
21
- next if store.key?(paranoia_class_methods)
22
-
23
- store[paranoia_class_methods].header = "module #{paranoia_class_methods}"
24
- store[paranoia_class_methods] << "def with_deleted: () -> #{base_name}::ActiveRecord_Relation"
25
- store[paranoia_class_methods] << "def only_deleted: () -> #{base_name}::ActiveRecord_Relation"
26
- store[paranoia_class_methods] << "alias deleted only_deleted"
27
- store[paranoia_class_methods] << "def paranoia_scope: () -> #{base_name}::ActiveRecord_Relation"
28
- store[paranoia_class_methods] << "alias without_deleted paranoia_scope"
20
+ relation_class = "#{base_name}::ActiveRecord_Relation"
21
+ paranoia_instance_methods = "::Paranoia::InstanceMethods[#{base_name}]"
22
+ paranoia_class_methods = "::Paranoia::ClassMethods[#{base_name}, #{relation_class}]"
29
23
 
24
+ store[base_name] << "include #{paranoia_instance_methods}"
30
25
  store[base_name] << "extend #{paranoia_class_methods}"
26
+
27
+ store[relation_class] << "include #{paranoia_class_methods}"
28
+
29
+ store["#{base_name}::ActiveRecord_Associations_CollectionProxy"] << "include #{paranoia_class_methods}"
31
30
  end
32
31
 
33
32
  store
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthoses-paranoia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-08 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: orthoses
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubygems_version: 3.6.2
74
+ rubygems_version: 3.8.0.dev
75
75
  specification_version: 4
76
76
  summary: Orthoses middleware for paranoia
77
77
  test_files: []