decorators 2.0.4 → 2.0.6
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 +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/decorators/paths.rb +2 -3
- data/lib/decorators/railtie.rb +1 -3
- data/lib/decorators.rb +23 -12
- data/readme.md +2 -2
- data.tar.gz.sig +0 -0
- metadata +31 -26
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 993059f9114ceb8ff5784d42e0aa1d87642a71e103fcfee620233344a9dd6ebd
|
4
|
+
data.tar.gz: e5751c372a8b3e6c21b9c58352f78d04274a91e414f85862d567ddf3cafadf42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68e31083dd400b8e518ea5622be34c14f31df9e986f9297200fb19691367e8e716b6d53c1fad9ce84bea4a020a5f6c6f7bd64dcd74ae7a05aada9c793cfc01fa
|
7
|
+
data.tar.gz: 71e99448ec24c5728912303030caf76ce3715be8957740a72da2f41da5334ddf323c1cc98444da395b3f562bb3d76f3ea458e67c44dae39109317856e5c66182
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/decorators/paths.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require "pathname"
|
2
2
|
|
3
3
|
module Decorators
|
4
4
|
class Paths
|
5
|
-
|
6
5
|
attr_reader :registered
|
6
|
+
|
7
7
|
def initialize(*args)
|
8
8
|
@registered = Array.new(*args)
|
9
9
|
end
|
@@ -11,6 +11,5 @@ module Decorators
|
|
11
11
|
def register!(path)
|
12
12
|
@registered << Pathname.new(path)
|
13
13
|
end
|
14
|
-
|
15
14
|
end
|
16
15
|
end
|
data/lib/decorators/railtie.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require "rails"
|
2
2
|
|
3
3
|
module Decorators
|
4
4
|
class Railtie < Rails::Railtie
|
5
|
-
|
6
5
|
config.before_initialize do |app|
|
7
6
|
loader = proc { Decorators.load!(app.config.cache_classes) }
|
8
7
|
|
@@ -12,6 +11,5 @@ module Decorators
|
|
12
11
|
app.config.to_prepare(&loader)
|
13
12
|
end
|
14
13
|
end
|
15
|
-
|
16
14
|
end
|
17
15
|
end
|
data/lib/decorators.rb
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
module Decorators
|
2
|
-
require
|
2
|
+
require "decorators/paths"
|
3
3
|
|
4
4
|
class << self
|
5
5
|
def load!(cache_classes)
|
6
|
+
decorators_with_argument_errors = []
|
6
7
|
decorators.each do |decorator|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
load_decorator(decorator, cache_classes)
|
9
|
+
rescue ArgumentError
|
10
|
+
decorators_with_argument_errors << decorator
|
11
|
+
end
|
12
|
+
|
13
|
+
decorators_with_argument_errors.each do |decorator|
|
14
|
+
load_decorator(decorator, cache_classes)
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
15
18
|
def decorators
|
16
|
-
paths.registered.map
|
19
|
+
paths.registered.map(&method(:find_decorators_in_path)).flatten.uniq
|
17
20
|
end
|
18
21
|
|
19
22
|
def register!(*paths_to_register)
|
@@ -22,24 +25,32 @@ module Decorators
|
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
25
|
-
|
28
|
+
private
|
29
|
+
|
26
30
|
def paths
|
27
31
|
@paths ||= Paths.new
|
28
32
|
end
|
29
33
|
|
30
34
|
def apply_decorators_pattern_to_path(path)
|
31
|
-
path.join
|
35
|
+
path.join(*pattern)
|
32
36
|
end
|
33
37
|
|
34
38
|
def find_decorators_in_path(path)
|
35
39
|
Dir[apply_decorators_pattern_to_path(path)]
|
36
40
|
end
|
37
41
|
|
42
|
+
def load_decorator(decorator, cache_classes)
|
43
|
+
if cache_classes
|
44
|
+
require decorator
|
45
|
+
else
|
46
|
+
load decorator
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
38
50
|
def pattern
|
39
|
-
[
|
51
|
+
["app", "decorators", "*", "**", "*_decorator.rb"]
|
40
52
|
end
|
41
53
|
end
|
42
|
-
|
43
54
|
end
|
44
55
|
|
45
|
-
require
|
56
|
+
require "decorators/railtie"
|
data/readme.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Decorators Plugin
|
1
|
+
# Decorators Plugin
|
2
2
|
|
3
3
|
This is a very simple plugin that adds support for decorators to your Rails application.
|
4
4
|
Effectively all that this does is allow you to register paths in which to search
|
@@ -26,7 +26,7 @@ The important parts are being inside a sub directory of `app/decorators` and hav
|
|
26
26
|
In your Gemfile, add the gem:
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
gem 'decorators', '~> 2.0.
|
29
|
+
gem 'decorators', '~> 2.0.6'
|
30
30
|
```
|
31
31
|
|
32
32
|
Now, run `bundle install` and the gem should install.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,36 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decorators
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Arndt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIEhjCCAu6gAwIBAgIBATANBgkqhkiG9w0BAQsFADBNMQ0wCwYDVQQDDARnZW1z
|
14
14
|
MREwDwYKCZImiZPyLGQBGRYBcDEVMBMGCgmSJomT8ixkARkWBWFybmR0MRIwEAYK
|
15
|
-
|
15
|
+
CZImiZPyLGQBGRYCaW8wHhcNMjQwNz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NVHRIEEzARgQ9nZW1zQHAuYXJuZHQuaW8wDQYJKoZIhvcN
|
29
|
+
AQELBQADggGBAAw69VoNOTd5HQOQczs0zm+p5bZw3e+EFiDy/N9o8Lv5rHfyGhA5
|
30
|
+
f+faBqfxQHDB3VSEFtCnoVFsCUaC1AdRzWztqS40x5GgQRwcM2llTwMYv5C++gC2
|
31
|
+
xPchTvi5FgDI++a05isObUvtNZ/wrZYBhy75ofzGAAMfuB/+XzsGbsOxSwZVlCne
|
32
|
+
YLkPa26euounYtKRGLz+X9YD4vDHP5VwsrqsvACMwVGHv+MIM3TQ3TvVrQ7QR9Ov
|
33
|
+
yUmuDhnAXep8omj9HyiukfqIdTsIMZK8nMcJH4wXC7mjjOBoyRtMwsQIT8OpwSP9
|
34
|
+
A7++64WBwTLbbGSCMCdw8X1kmmaZjaPrNkJ4wNaeJPZPPgDmL1XKJavQ8xZ/nwGF
|
35
|
+
VXf+6/IyX9OrQwL2uw0b+1NiR2gFpOLcOy2ixKdua13S9CWRRsR3VJve+PIyycC7
|
36
|
+
aLV+FI9i9b1YUXG2gDKqLOkF/FNBWNckAmGj7kYkdLG76G5aRGP0HvfKbIiQ3HTC
|
37
|
+
jAtsfxiSgc0fAw==
|
32
38
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
39
|
+
date: 2024-07-25 00:00:00.000000000 Z
|
34
40
|
dependencies:
|
35
41
|
- !ruby/object:Gem::Dependency
|
36
42
|
name: railties
|
@@ -41,7 +47,7 @@ dependencies:
|
|
41
47
|
version: 4.0.0
|
42
48
|
- - "<"
|
43
49
|
- !ruby/object:Gem::Version
|
44
|
-
version: '
|
50
|
+
version: '7.2'
|
45
51
|
type: :runtime
|
46
52
|
prerelease: false
|
47
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,7 +57,7 @@ dependencies:
|
|
51
57
|
version: 4.0.0
|
52
58
|
- - "<"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '7.2'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rspec
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,7 +93,7 @@ homepage: https://github.com/parndt/decorators
|
|
87
93
|
licenses:
|
88
94
|
- MIT
|
89
95
|
metadata: {}
|
90
|
-
post_install_message:
|
96
|
+
post_install_message:
|
91
97
|
rdoc_options: []
|
92
98
|
require_paths:
|
93
99
|
- lib
|
@@ -102,9 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
108
|
- !ruby/object:Gem::Version
|
103
109
|
version: '0'
|
104
110
|
requirements: []
|
105
|
-
|
106
|
-
|
107
|
-
signing_key:
|
111
|
+
rubygems_version: 3.1.6
|
112
|
+
signing_key:
|
108
113
|
specification_version: 4
|
109
114
|
summary: Rails decorators plugin.
|
110
115
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|