rbs_draper 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78fc355f126b6fad89da00fd5a6f33a67fb0de4b7242f57a49826d3bad1f6246
4
- data.tar.gz: c4d636fc57de09959c81ad783bd567f5ca5e4b56f46fd0ab5442d7d65c9f3154
3
+ metadata.gz: 44e80ca97ef57836af3ef885d059d9e1d1a2a9d6ba4dab80adf6d30f01556f9c
4
+ data.tar.gz: 5926448a80b1f772f38044e562779ffda88c1336f262456df6d6d63b0be32453
5
5
  SHA512:
6
- metadata.gz: 9cf067be8404f7a8842738994ae3971875a9542d0c2784cf3e0ecf9c33bf113298d457a67372d1131f899466c1a566838fe92063071db8808cbed99d755d4000
7
- data.tar.gz: d684fb48ed0a3be6bc23ceb4ff4760c01ebfe3e2a6e16f8bc78cbeb65c01f4e7f10926e8bf8abd12ba3c253fe505fa52a2d06e87be0445b4f221fd3ef9150949
6
+ metadata.gz: b3375123ce9db9a5fa0815f390b4212cdfbdc60496223fa3797a5f0d2bd087230a44e4cbe980e963f7d3741c49351bf0a69c20847d0d049c26f6087cbdd87f4f
7
+ data.tar.gz: 2a8d79b1e174b7dec3e818c65acf2e9005fbdf5e3a6096a22b4b5fffdb00fa5626c306d7ed40526ff900cdb27b790e2eedbee2eb6753fc913f76393faaa73c0b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs_draper (1.1.2)
4
+ rbs_draper (1.2.0)
5
5
  activesupport
6
6
  draper
7
7
  fileutils
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,7 +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
7
+ def self.decorates_association: (Symbol association, **untyped options) -> void
4
8
  def decorated?: () -> bool
5
9
  def decorated_with?: (untyped decorator_class) -> bool
6
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
7
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbsDraper
4
- VERSION = "1.1.2"
4
+ VERSION = "1.2.0"
5
5
  end
@@ -2,7 +2,7 @@
2
2
  sources:
3
3
  - type: git
4
4
  name: ruby/gem_rbs_collection
5
- revision: 5666e737d2b27a8425b4e3855c1a38cae54989f7
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: 306d1aec19defeb177e217d8aad9812a52bcd5eb
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: 306d1aec19defeb177e217d8aad9812a52bcd5eb
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: 306d1aec19defeb177e217d8aad9812a52bcd5eb
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: 306d1aec19defeb177e217d8aad9812a52bcd5eb
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: 306d1aec19defeb177e217d8aad9812a52bcd5eb
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: 306d1aec19defeb177e217d8aad9812a52bcd5eb
59
+ revision: 248499a924c3cb331d40ca667d40528814043788
60
60
  remote: https://github.com/ruby/gem_rbs_collection.git
61
61
  repo_dir: gems
62
62
  - name: base64
@@ -72,13 +72,17 @@ gems:
72
72
  source:
73
73
  type: git
74
74
  name: ruby/gem_rbs_collection
75
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
75
+ revision: 248499a924c3cb331d40ca667d40528814043788
76
76
  remote: https://github.com/ruby/gem_rbs_collection.git
77
77
  repo_dir: gems
78
78
  - name: date
79
79
  version: '0'
80
80
  source:
81
81
  type: stdlib
82
+ - name: erb
83
+ version: '0'
84
+ source:
85
+ type: stdlib
82
86
  - name: fileutils
83
87
  version: '0'
84
88
  source:
@@ -88,7 +92,7 @@ gems:
88
92
  source:
89
93
  type: git
90
94
  name: ruby/gem_rbs_collection
91
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
95
+ revision: 248499a924c3cb331d40ca667d40528814043788
92
96
  remote: https://github.com/ruby/gem_rbs_collection.git
93
97
  repo_dir: gems
94
98
  - name: json
@@ -116,7 +120,7 @@ gems:
116
120
  source:
117
121
  type: git
118
122
  name: ruby/gem_rbs_collection
119
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
123
+ revision: 248499a924c3cb331d40ca667d40528814043788
120
124
  remote: https://github.com/ruby/gem_rbs_collection.git
121
125
  repo_dir: gems
122
126
  - name: optparse
@@ -128,7 +132,7 @@ gems:
128
132
  source:
129
133
  type: git
130
134
  name: ruby/gem_rbs_collection
131
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
135
+ revision: 248499a924c3cb331d40ca667d40528814043788
132
136
  remote: https://github.com/ruby/gem_rbs_collection.git
133
137
  repo_dir: gems
134
138
  - name: pathname
@@ -140,7 +144,7 @@ gems:
140
144
  source:
141
145
  type: git
142
146
  name: ruby/gem_rbs_collection
143
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
147
+ revision: 248499a924c3cb331d40ca667d40528814043788
144
148
  remote: https://github.com/ruby/gem_rbs_collection.git
145
149
  repo_dir: gems
146
150
  - name: rails-dom-testing
@@ -148,7 +152,7 @@ gems:
148
152
  source:
149
153
  type: git
150
154
  name: ruby/gem_rbs_collection
151
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
155
+ revision: 248499a924c3cb331d40ca667d40528814043788
152
156
  remote: https://github.com/ruby/gem_rbs_collection.git
153
157
  repo_dir: gems
154
158
  - name: railties
@@ -156,7 +160,7 @@ gems:
156
160
  source:
157
161
  type: git
158
162
  name: ruby/gem_rbs_collection
159
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
163
+ revision: 248499a924c3cb331d40ca667d40528814043788
160
164
  remote: https://github.com/ruby/gem_rbs_collection.git
161
165
  repo_dir: gems
162
166
  - name: rainbow
@@ -164,7 +168,7 @@ gems:
164
168
  source:
165
169
  type: git
166
170
  name: ruby/gem_rbs_collection
167
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
171
+ revision: 248499a924c3cb331d40ca667d40528814043788
168
172
  remote: https://github.com/ruby/gem_rbs_collection.git
169
173
  repo_dir: gems
170
174
  - name: rbs
@@ -180,7 +184,7 @@ gems:
180
184
  source:
181
185
  type: git
182
186
  name: ruby/gem_rbs_collection
183
- revision: 306d1aec19defeb177e217d8aad9812a52bcd5eb
187
+ revision: 248499a924c3cb331d40ca667d40528814043788
184
188
  remote: https://github.com/ruby/gem_rbs_collection.git
185
189
  repo_dir: gems
186
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.1.2
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-02 00:00:00.000000000 Z
11
+ date: 2023-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport