rbs_draper 1.1.3 → 1.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/Gemfile.lock +1 -1
- data/README.md +15 -0
- data/lib/rbs_draper/sig/decorator.rbs +26 -0
- data/lib/rbs_draper/version.rb +1 -1
- data/rbs_collection.lock.yaml +16 -16
- 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: 44e80ca97ef57836af3ef885d059d9e1d1a2a9d6ba4dab80adf6d30f01556f9c
|
4
|
+
data.tar.gz: 5926448a80b1f772f38044e562779ffda88c1336f262456df6d6d63b0be32453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3375123ce9db9a5fa0815f390b4212cdfbdc60496223fa3797a5f0d2bd087230a44e4cbe980e963f7d3741c49351bf0a69c20847d0d049c26f6087cbdd87f4f
|
7
|
+
data.tar.gz: 2a8d79b1e174b7dec3e818c65acf2e9005fbdf5e3a6096a22b4b5fffdb00fa5626c306d7ed40526ff900cdb27b790e2eedbee2eb6753fc913f76393faaa73c0b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,6 +21,21 @@ decorator names to model names in `lib/tasks/rbs_draper.rake`. For example:
|
|
21
21
|
task.mapping = -> { { AdminUserDecorator => User } }
|
22
22
|
end
|
23
23
|
|
24
|
+
## Accessing Helpers
|
25
|
+
|
26
|
+
If your decorators access to the custom helpers via `#h` method, you need to define the types
|
27
|
+
for the custom helpers into `Draper::HelperProxy`:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
module Draper
|
31
|
+
class HelperProxy
|
32
|
+
include MyCustomHelper
|
33
|
+
|
34
|
+
def my_custom_helper_method: (String, String) -> String
|
35
|
+
end
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
24
39
|
## Usage
|
25
40
|
|
26
41
|
1. Run `rbs:draper:clean` at first
|
@@ -1,8 +1,34 @@
|
|
1
1
|
module Draper
|
2
2
|
class Decorator
|
3
|
+
include Draper::ViewHelpers
|
4
|
+
extend Draper::ViewHelpers::ClassMethods
|
5
|
+
|
3
6
|
def self.delegate_all: () -> void
|
4
7
|
def self.decorates_association: (Symbol association, **untyped options) -> void
|
5
8
|
def decorated?: () -> bool
|
6
9
|
def decorated_with?: (untyped decorator_class) -> bool
|
7
10
|
end
|
11
|
+
|
12
|
+
class HelperProxy
|
13
|
+
# Note: HelperProxy behaves like ActiveView::Base via method_missing.
|
14
|
+
# To support it, this type includes the sub-modules of ActiveView instead of method_missing.
|
15
|
+
|
16
|
+
include ActionView::Helpers
|
17
|
+
include ERB::Util
|
18
|
+
include ActionView::Context
|
19
|
+
end
|
20
|
+
|
21
|
+
module ViewHelpers
|
22
|
+
module ClassMethods
|
23
|
+
def helpers: () -> HelperProxy
|
24
|
+
|
25
|
+
alias h helpers
|
26
|
+
end
|
27
|
+
|
28
|
+
def helpers: () -> HelperProxy
|
29
|
+
def localize: (*untyped) -> String
|
30
|
+
|
31
|
+
alias h helpers
|
32
|
+
alias l localize
|
33
|
+
end
|
8
34
|
end
|
data/lib/rbs_draper/version.rb
CHANGED
data/rbs_collection.lock.yaml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
sources:
|
3
3
|
- type: git
|
4
4
|
name: ruby/gem_rbs_collection
|
5
|
-
revision:
|
5
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
6
6
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
7
7
|
repo_dir: gems
|
8
8
|
path: ".gem_rbs_collection"
|
@@ -16,7 +16,7 @@ gems:
|
|
16
16
|
source:
|
17
17
|
type: git
|
18
18
|
name: ruby/gem_rbs_collection
|
19
|
-
revision:
|
19
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
20
20
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
21
21
|
repo_dir: gems
|
22
22
|
- name: actionview
|
@@ -24,7 +24,7 @@ gems:
|
|
24
24
|
source:
|
25
25
|
type: git
|
26
26
|
name: ruby/gem_rbs_collection
|
27
|
-
revision:
|
27
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
28
28
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
29
29
|
repo_dir: gems
|
30
30
|
- name: activemodel
|
@@ -32,7 +32,7 @@ gems:
|
|
32
32
|
source:
|
33
33
|
type: git
|
34
34
|
name: ruby/gem_rbs_collection
|
35
|
-
revision:
|
35
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
36
36
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
37
37
|
repo_dir: gems
|
38
38
|
- name: activerecord
|
@@ -40,7 +40,7 @@ gems:
|
|
40
40
|
source:
|
41
41
|
type: git
|
42
42
|
name: ruby/gem_rbs_collection
|
43
|
-
revision:
|
43
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
44
44
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
45
45
|
repo_dir: gems
|
46
46
|
- name: activesupport
|
@@ -48,7 +48,7 @@ gems:
|
|
48
48
|
source:
|
49
49
|
type: git
|
50
50
|
name: ruby/gem_rbs_collection
|
51
|
-
revision:
|
51
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
52
52
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
53
53
|
repo_dir: gems
|
54
54
|
- name: ast
|
@@ -56,7 +56,7 @@ gems:
|
|
56
56
|
source:
|
57
57
|
type: git
|
58
58
|
name: ruby/gem_rbs_collection
|
59
|
-
revision:
|
59
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
60
60
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
61
61
|
repo_dir: gems
|
62
62
|
- name: base64
|
@@ -72,7 +72,7 @@ gems:
|
|
72
72
|
source:
|
73
73
|
type: git
|
74
74
|
name: ruby/gem_rbs_collection
|
75
|
-
revision:
|
75
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
76
76
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
77
77
|
repo_dir: gems
|
78
78
|
- name: date
|
@@ -92,7 +92,7 @@ gems:
|
|
92
92
|
source:
|
93
93
|
type: git
|
94
94
|
name: ruby/gem_rbs_collection
|
95
|
-
revision:
|
95
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
96
96
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
97
97
|
repo_dir: gems
|
98
98
|
- name: json
|
@@ -120,7 +120,7 @@ gems:
|
|
120
120
|
source:
|
121
121
|
type: git
|
122
122
|
name: ruby/gem_rbs_collection
|
123
|
-
revision:
|
123
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
124
124
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
125
125
|
repo_dir: gems
|
126
126
|
- name: optparse
|
@@ -132,7 +132,7 @@ gems:
|
|
132
132
|
source:
|
133
133
|
type: git
|
134
134
|
name: ruby/gem_rbs_collection
|
135
|
-
revision:
|
135
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
136
136
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
137
137
|
repo_dir: gems
|
138
138
|
- name: pathname
|
@@ -144,7 +144,7 @@ gems:
|
|
144
144
|
source:
|
145
145
|
type: git
|
146
146
|
name: ruby/gem_rbs_collection
|
147
|
-
revision:
|
147
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
148
148
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
149
149
|
repo_dir: gems
|
150
150
|
- name: rails-dom-testing
|
@@ -152,7 +152,7 @@ gems:
|
|
152
152
|
source:
|
153
153
|
type: git
|
154
154
|
name: ruby/gem_rbs_collection
|
155
|
-
revision:
|
155
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
156
156
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
157
157
|
repo_dir: gems
|
158
158
|
- name: railties
|
@@ -160,7 +160,7 @@ gems:
|
|
160
160
|
source:
|
161
161
|
type: git
|
162
162
|
name: ruby/gem_rbs_collection
|
163
|
-
revision:
|
163
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
164
164
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
165
165
|
repo_dir: gems
|
166
166
|
- name: rainbow
|
@@ -168,7 +168,7 @@ gems:
|
|
168
168
|
source:
|
169
169
|
type: git
|
170
170
|
name: ruby/gem_rbs_collection
|
171
|
-
revision:
|
171
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
172
172
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
173
173
|
repo_dir: gems
|
174
174
|
- name: rbs
|
@@ -184,7 +184,7 @@ gems:
|
|
184
184
|
source:
|
185
185
|
type: git
|
186
186
|
name: ruby/gem_rbs_collection
|
187
|
-
revision:
|
187
|
+
revision: 248499a924c3cb331d40ca667d40528814043788
|
188
188
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
189
189
|
repo_dir: gems
|
190
190
|
- name: securerandom
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs_draper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi KOMIYA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|