orthoses-active_decorator 0.1.0 → 0.2.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 +4 -4
- data/README.md +2 -5
- data/lib/orthoses/active_decorator/version.rb +1 -1
- data/lib/orthoses/active_decorator.rb +9 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1998088b9e2bf6f7cdb393f6f0f0d9d1a177db8660109fa007d23b0399212d9
|
4
|
+
data.tar.gz: 5abc11610946eed2dde2ad38e5b51bd20df3827b1b215917ab0e7ff4046bcbb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d59b1fe7e674bc18eae55abcea87a53b01b4106a019a8faaca7f31fe0a0cd4443dbbb4ef189b1fdad52bda84ed64a3adb6a858b9addb57db2899ae7d8f72ff3a
|
7
|
+
data.tar.gz: e6464955ce646579aa3952c36b754777ee14c6cbc2f4e73b7e36b1abc90f6a626254f4136fdc6dd80aaf663020cacdd1dcc8f6c937df773f42406347e0b75c0b
|
data/README.md
CHANGED
@@ -22,21 +22,18 @@ module UserDecorator : User
|
|
22
22
|
end
|
23
23
|
```
|
24
24
|
|
25
|
-
|
26
25
|
## Installation
|
27
26
|
|
28
|
-
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.
|
29
|
-
|
30
27
|
Install the gem and add to the application's Gemfile by executing:
|
31
28
|
|
32
29
|
```bash
|
33
|
-
bundle add
|
30
|
+
bundle add orthoses-active_decorator
|
34
31
|
```
|
35
32
|
|
36
33
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
37
34
|
|
38
35
|
```bash
|
39
|
-
gem install
|
36
|
+
gem install orthoses-active_decorator
|
40
37
|
```
|
41
38
|
|
42
39
|
## Usage
|
@@ -12,7 +12,7 @@ module Orthoses
|
|
12
12
|
@loader.call.tap do |store|
|
13
13
|
decorator_modules.each do |mod|
|
14
14
|
decorator_name = mod.name
|
15
|
-
model_name =
|
15
|
+
model_name = decorator_name.delete_suffix(decorator_suffix)
|
16
16
|
begin
|
17
17
|
model_name.constantize
|
18
18
|
rescue NameError
|
@@ -25,13 +25,19 @@ module Orthoses
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
+
def decorator_suffix
|
29
|
+
::ActiveDecorator.config.decorator_suffix
|
30
|
+
end
|
31
|
+
|
28
32
|
def decorator_modules
|
33
|
+
app_decorators_path = ::Rails.root.join("app/decorators").to_s
|
29
34
|
ObjectSpace.each_object(Module).select do |mod|
|
30
35
|
name = Orthoses::Utils.module_name(mod) or next
|
31
|
-
next unless name.end_with?(
|
36
|
+
next unless name.end_with?(decorator_suffix)
|
32
37
|
|
33
38
|
path, _line = Object.const_source_location(name)
|
34
|
-
next unless path&.start_with?(
|
39
|
+
next unless path&.start_with?(app_decorators_path)
|
40
|
+
next if Class === mod
|
35
41
|
|
36
42
|
mod
|
37
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthoses-active_decorator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
75
|
+
rubygems_version: 3.6.9
|
76
76
|
specification_version: 4
|
77
77
|
summary: Orthoses middleware for active_decorator
|
78
78
|
test_files: []
|