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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86cd01624905c36abfd25ca01f1cf020d4f6fc35a15c23e09ea8a922104cbbf8
4
- data.tar.gz: c51e0230d9525c4dbf29888dd10447c89b5f703d609f4333322c3718de0f7029
3
+ metadata.gz: a1998088b9e2bf6f7cdb393f6f0f0d9d1a177db8660109fa007d23b0399212d9
4
+ data.tar.gz: 5abc11610946eed2dde2ad38e5b51bd20df3827b1b215917ab0e7ff4046bcbb1
5
5
  SHA512:
6
- metadata.gz: 487fc506bc0af1ea9c6868fd8868d821fb328cd593f8cbac8ac3b6c0cc0f9aff142b7bcaff38ec25d3f1153ae9199e879ea3c43459a50acef962224f200061ed
7
- data.tar.gz: 6f29181c21d46fc02b3c3416158fdf63408b7c99ebec6c96c7fe0a54421eaf1961b0f7e0d6ff688bba03e26b4fc5581916129f718a4d7e2afc8727be5b1d6f5e
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
36
+ gem install orthoses-active_decorator
40
37
  ```
41
38
 
42
39
  ## Usage
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Orthoses
4
4
  class ActiveDecorator
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
@@ -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 = mod.name.sub("Decorator", "")
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?("Decorator")
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?(::Rails.root.join("app/decorators").to_s)
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.1.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.8.0.dev
75
+ rubygems_version: 3.6.9
76
76
  specification_version: 4
77
77
  summary: Orthoses middleware for active_decorator
78
78
  test_files: []