m2m_keygen 0.4.7 → 0.5.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.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/.overcommit.yml +4 -7
  3. data/.rubocop.yml +19 -16
  4. data/.ruby-version +1 -1
  5. data/.streerc +1 -0
  6. data/.tool-versions +1 -0
  7. data/CHANGELOG.md +73 -1
  8. data/Gemfile +2 -2
  9. data/Gemfile.lock +138 -160
  10. data/README.md +64 -78
  11. data/docs/MIGRATING.md +69 -0
  12. data/docs/SPEC.md +245 -0
  13. data/examples/nonce_store/postgres.rb +40 -0
  14. data/examples/nonce_store/redis.rb +23 -0
  15. data/gemfiles/rack_2.gemfile +5 -0
  16. data/gemfiles/rack_3.gemfile +5 -0
  17. data/lib/m2m_keygen/canonicalizer.rb +57 -0
  18. data/lib/m2m_keygen/nonce_store/disabled.rb +19 -0
  19. data/lib/m2m_keygen/nonce_store/memory.rb +64 -0
  20. data/lib/m2m_keygen/nonce_store.rb +18 -0
  21. data/lib/m2m_keygen/rack_validator.rb +72 -19
  22. data/lib/m2m_keygen/request_signer/signed_request.rb +10 -0
  23. data/lib/m2m_keygen/request_signer.rb +118 -0
  24. data/lib/m2m_keygen/signature.rb +41 -39
  25. data/lib/m2m_keygen/types/params_type.rb +6 -16
  26. data/lib/m2m_keygen/version.rb +1 -1
  27. data/lib/m2m_keygen.rb +6 -0
  28. data/m2m_keygen.gemspec +12 -14
  29. data/sorbet/config +1 -0
  30. data/sorbet/rbi/gems/.gitattributes +1 -0
  31. data/sorbet/rbi/gems/{ast@2.4.2.rbi → ast@2.4.3.rbi} +45 -79
  32. data/sorbet/rbi/gems/{benchmark@0.2.0.rbi → benchmark@0.5.0.rbi} +91 -58
  33. data/sorbet/rbi/gems/bundler-audit@0.9.3.rbi +397 -0
  34. data/sorbet/rbi/gems/byebug@13.0.0.rbi +3651 -0
  35. data/sorbet/rbi/gems/childprocess@5.1.0.rbi +336 -0
  36. data/sorbet/rbi/gems/concurrent-ruby@1.3.7.rbi +384 -0
  37. data/sorbet/rbi/gems/{diff-lcs@1.5.0.rbi → diff-lcs@1.6.2.rbi} +189 -199
  38. data/sorbet/rbi/gems/{docile@1.4.0.rbi → docile@1.4.1.rbi} +147 -147
  39. data/sorbet/rbi/gems/dotenv@3.2.0.rbi +267 -0
  40. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  41. data/sorbet/rbi/gems/{faker@2.22.0.rbi → faker@3.8.0.rbi} +8468 -3829
  42. data/sorbet/rbi/gems/{ffi@1.15.5.rbi → ffi@1.17.4.rbi} +1 -0
  43. data/sorbet/rbi/gems/{formatador@1.1.0.rbi → formatador@1.2.3.rbi} +1 -0
  44. data/sorbet/rbi/gems/{guard@2.18.0.rbi → guard@2.20.1.rbi} +1 -0
  45. data/sorbet/rbi/gems/{i18n@1.12.0.rbi → i18n@1.15.2.rbi} +687 -827
  46. data/sorbet/rbi/gems/io-console@0.8.2.rbi +9 -0
  47. data/sorbet/rbi/gems/{json@2.6.2.rbi → json@2.20.0.rbi} +994 -252
  48. data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
  49. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  50. data/sorbet/rbi/gems/listen@3.10.0.rbi +9 -0
  51. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  52. data/sorbet/rbi/gems/{lumberjack@1.2.8.rbi → lumberjack@1.4.2.rbi} +1 -0
  53. data/sorbet/rbi/gems/{method_source@1.0.0.rbi → method_source@1.1.0.rbi} +111 -90
  54. data/sorbet/rbi/gems/{overcommit@0.59.1.rbi → overcommit@0.71.0.rbi} +503 -647
  55. data/sorbet/rbi/gems/parallel@2.1.0.rbi +321 -0
  56. data/sorbet/rbi/gems/parser@3.3.11.1.rbi +5229 -0
  57. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +878 -0
  58. data/sorbet/rbi/gems/prism@1.9.0.rbi +42224 -0
  59. data/sorbet/rbi/gems/pry-byebug@3.12.0.rbi +481 -0
  60. data/sorbet/rbi/gems/{pry@0.14.1.rbi → pry@0.16.0.rbi} +2567 -3550
  61. data/sorbet/rbi/gems/{racc@1.6.0.rbi → racc@1.8.1.rbi} +54 -40
  62. data/sorbet/rbi/gems/rack@3.2.6.rbi +4653 -0
  63. data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.4.2.rbi} +963 -732
  64. data/sorbet/rbi/gems/{rb-inotify@0.10.1.rbi → rb-inotify@0.11.1.rbi} +1 -0
  65. data/sorbet/rbi/gems/rbi@0.3.14.rbi +5519 -0
  66. data/sorbet/rbi/gems/rbs@4.0.3.rbi +6908 -0
  67. data/sorbet/rbi/gems/regexp_parser@2.12.0.rbi +3398 -0
  68. data/sorbet/rbi/gems/reline@0.6.3.rbi +2446 -0
  69. data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
  70. data/sorbet/rbi/gems/{rexml@3.2.5.rbi → rexml@3.4.4.rbi} +1085 -894
  71. data/sorbet/rbi/gems/rspec-core@3.13.6.rbi +9475 -0
  72. data/sorbet/rbi/gems/rspec-expectations@3.13.5.rbi +6108 -0
  73. data/sorbet/rbi/gems/rspec-mocks@3.13.8.rbi +4787 -0
  74. data/sorbet/rbi/gems/rspec-support@3.13.7.rbi +1274 -0
  75. data/sorbet/rbi/gems/rspec@3.13.2.rbi +15 -0
  76. data/sorbet/rbi/gems/rspec_in_context@1.2.2.rbi +294 -0
  77. data/sorbet/rbi/gems/rubocop-ast@1.49.1.rbi +7140 -0
  78. data/sorbet/rbi/gems/rubocop-faker@1.3.0.rbi +88 -0
  79. data/sorbet/rbi/gems/rubocop-performance@1.26.1.rbi +3403 -0
  80. data/sorbet/rbi/gems/rubocop-sorbet@0.12.0.rbi +2448 -0
  81. data/sorbet/rbi/gems/rubocop@1.88.1.rbi +63103 -0
  82. data/sorbet/rbi/gems/ruby-lsp@0.26.9.rbi +28 -0
  83. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  84. data/sorbet/rbi/gems/rubydex@0.2.7.rbi +836 -0
  85. data/sorbet/rbi/gems/simplecov-html@0.13.2.rbi +90 -0
  86. data/sorbet/rbi/gems/{simplecov@0.21.2.rbi → simplecov@0.22.0.rbi} +438 -578
  87. data/sorbet/rbi/gems/spoom@1.8.2.rbi +6691 -0
  88. data/sorbet/rbi/gems/syntax_tree@6.3.0.rbi +22090 -0
  89. data/sorbet/rbi/gems/tapioca@0.19.2.rbi +3597 -0
  90. data/sorbet/rbi/gems/{thor@1.2.1.rbi → thor@1.5.0.rbi} +1085 -1171
  91. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  92. data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +130 -0
  93. data/sorbet/rbi/gems/unicode-emoji@4.2.0.rbi +332 -0
  94. data/sorbet/rbi/gems/{yard-sorbet@0.7.0.rbi → yard-sorbet@0.9.0.rbi} +142 -99
  95. data/sorbet/rbi/gems/{yard@0.9.28.rbi → yard@0.9.44.rbi} +5350 -6316
  96. data/sorbet/rbi/gems/zeitwerk@2.8.2.rbi +1178 -0
  97. metadata +106 -111
  98. data/.prettierrc.js +0 -4
  99. data/docs/M2mKeygen/Error.html +0 -135
  100. data/docs/M2mKeygen/ParamsEncoder.html +0 -321
  101. data/docs/M2mKeygen/RackValidator.html +0 -533
  102. data/docs/M2mKeygen/Signature.html +0 -680
  103. data/docs/M2mKeygen/Types.html +0 -147
  104. data/docs/M2mKeygen.html +0 -157
  105. data/docs/_index.html +0 -182
  106. data/docs/class_list.html +0 -51
  107. data/docs/css/common.css +0 -1
  108. data/docs/css/full_list.css +0 -58
  109. data/docs/css/style.css +0 -497
  110. data/docs/file.README.html +0 -230
  111. data/docs/file_list.html +0 -56
  112. data/docs/frames.html +0 -17
  113. data/docs/index.html +0 -230
  114. data/docs/js/app.js +0 -314
  115. data/docs/js/full_list.js +0 -216
  116. data/docs/js/jquery.js +0 -4
  117. data/docs/method_list.html +0 -139
  118. data/docs/top-level-namespace.html +0 -110
  119. data/lib/m2m_keygen/params_encoder.rb +0 -56
  120. data/package.json +0 -12
  121. data/sig/m2m_keygen.rbs +0 -4
  122. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +0 -18608
  123. data/sorbet/rbi/gems/backport@1.2.0.rbi +0 -522
  124. data/sorbet/rbi/gems/bundler-audit@0.9.1.rbi +0 -308
  125. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3603
  126. data/sorbet/rbi/gems/childprocess@4.1.0.rbi +0 -401
  127. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +0 -11581
  128. data/sorbet/rbi/gems/dotenv@2.8.1.rbi +0 -234
  129. data/sorbet/rbi/gems/e2mmap@0.1.0.rbi +0 -8
  130. data/sorbet/rbi/gems/haml@5.2.2.rbi +0 -3190
  131. data/sorbet/rbi/gems/jaro_winkler@1.5.4.rbi +0 -19
  132. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +0 -133
  133. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +0 -3261
  134. data/sorbet/rbi/gems/listen@3.7.1.rbi +0 -1181
  135. data/sorbet/rbi/gems/minitest@5.16.3.rbi +0 -1459
  136. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +0 -6514
  137. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -277
  138. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +0 -6826
  139. data/sorbet/rbi/gems/prettier@3.2.0.rbi +0 -22
  140. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +0 -8
  141. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1222
  142. data/sorbet/rbi/gems/rack@2.2.4.rbi +0 -5630
  143. data/sorbet/rbi/gems/rbi@0.0.15.rbi +0 -3007
  144. data/sorbet/rbi/gems/rbs@2.6.0.rbi +0 -8
  145. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +0 -3366
  146. data/sorbet/rbi/gems/reverse_markdown@2.1.1.rbi +0 -389
  147. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +0 -10786
  148. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +0 -8170
  149. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +0 -5385
  150. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +0 -1746
  151. data/sorbet/rbi/gems/rspec@3.11.0.rbi +0 -187
  152. data/sorbet/rbi/gems/rspec_in_context@1.1.0.3.rbi +0 -1113
  153. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +0 -7044
  154. data/sorbet/rbi/gems/rubocop-faker@1.1.0.rbi +0 -106
  155. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +0 -2982
  156. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +0 -990
  157. data/sorbet/rbi/gems/rubocop@1.35.1.rbi +0 -52002
  158. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -1239
  159. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +0 -219
  160. data/sorbet/rbi/gems/solargraph@0.46.0.rbi +0 -9075
  161. data/sorbet/rbi/gems/spoom@1.1.12.rbi +0 -2369
  162. data/sorbet/rbi/gems/syntax_tree-haml@1.3.1.rbi +0 -8
  163. data/sorbet/rbi/gems/syntax_tree-rbs@0.5.0.rbi +0 -8
  164. data/sorbet/rbi/gems/syntax_tree@3.5.0.rbi +0 -8
  165. data/sorbet/rbi/gems/tapioca@0.9.4.rbi +0 -2946
  166. data/sorbet/rbi/gems/temple@0.8.2.rbi +0 -1712
  167. data/sorbet/rbi/gems/tilt@2.0.11.rbi +0 -742
  168. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +0 -5914
  169. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +0 -48
  170. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -4529
  171. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -2553
  172. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +0 -867
  173. data/sorbet/rbi/manual.rbi +0 -7
  174. data/yarn.lock +0 -20
@@ -1,742 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `tilt` gem.
5
- # Please instead update this file by running `bin/tapioca gem tilt`.
6
-
7
- # Namespace for Tilt. This module is not intended to be included anywhere.
8
- #
9
- # source://tilt-2.0.11/lib/tilt/mapping.rb:3
10
- module Tilt
11
- class << self
12
- # @see Tilt::Mapping#[]
13
- #
14
- # source://tilt-2.0.11/lib/tilt.rb:47
15
- def [](file); end
16
-
17
- # @example
18
- # tmpl = Tilt['index.erb'].new { '<%= Tilt.current_template %>' }
19
- # tmpl.render == tmpl.to_s
20
- # @note This is currently an experimental feature and might return nil
21
- # in the future.
22
- # @return the template object that is currently rendering.
23
- #
24
- # source://tilt-2.0.11/lib/tilt.rb:69
25
- def current_template; end
26
-
27
- # @return [Tilt::Mapping] the main mapping object
28
- #
29
- # source://tilt-2.0.11/lib/tilt.rb:12
30
- def default_mapping; end
31
-
32
- # @private
33
- #
34
- # source://tilt-2.0.11/lib/tilt.rb:17
35
- def lazy_map; end
36
-
37
- # @see Tilt::Mapping#new
38
- #
39
- # source://tilt-2.0.11/lib/tilt.rb:42
40
- def new(file, line = T.unsafe(nil), options = T.unsafe(nil), &block); end
41
-
42
- # @deprecated Use {register} instead.
43
- #
44
- # source://tilt-2.0.11/lib/tilt.rb:32
45
- def prefer(template_class, *extensions); end
46
-
47
- # @see Tilt::Mapping#register
48
- #
49
- # source://tilt-2.0.11/lib/tilt.rb:22
50
- def register(template_class, *extensions); end
51
-
52
- # @see Tilt::Mapping#register_lazy
53
- #
54
- # source://tilt-2.0.11/lib/tilt.rb:27
55
- def register_lazy(class_name, file, *extensions); end
56
-
57
- # @return [Boolean]
58
- # @see Tilt::Mapping#registered?
59
- #
60
- # source://tilt-2.0.11/lib/tilt.rb:37
61
- def registered?(ext); end
62
-
63
- # @see Tilt::Mapping#template_for
64
- #
65
- # source://tilt-2.0.11/lib/tilt.rb:52
66
- def template_for(file); end
67
-
68
- # @see Tilt::Mapping#templates_for
69
- #
70
- # source://tilt-2.0.11/lib/tilt.rb:57
71
- def templates_for(file); end
72
- end
73
- end
74
-
75
- # CSV Template implementation. See:
76
- # http://ruby-doc.org/stdlib/libdoc/csv/rdoc/CSV.html
77
- #
78
- # == Example
79
- #
80
- # # Example of csv template
81
- # tpl = <<-EOS
82
- # # header
83
- # csv << ['NAME', 'ID']
84
- #
85
- # # data rows
86
- # @people.each do |person|
87
- # csv << [person[:name], person[:id]]
88
- # end
89
- # EOS
90
- #
91
- # @people = [
92
- # {:name => "Joshua Peek", :id => 1},
93
- # {:name => "Ryan Tomayko", :id => 2},
94
- # {:name => "Simone Carletti", :id => 3}
95
- # ]
96
- #
97
- # template = Tilt::CSVTemplate.new { tpl }
98
- # template.render(self)
99
- #
100
- # source://tilt-2.0.11/lib/tilt/csv.rb:36
101
- class Tilt::CSVTemplate < ::Tilt::Template
102
- # source://tilt-2.0.11/lib/tilt/csv.rb:59
103
- def precompiled(locals); end
104
-
105
- # source://tilt-2.0.11/lib/tilt/csv.rb:51
106
- def precompiled_template(locals); end
107
-
108
- # source://tilt-2.0.11/lib/tilt/csv.rb:47
109
- def prepare; end
110
-
111
- class << self
112
- # source://tilt-2.0.11/lib/tilt/csv.rb:39
113
- def engine; end
114
- end
115
- end
116
-
117
- # Extremely simple template cache implementation. Calling applications
118
- # create a Tilt::Cache instance and use #fetch with any set of hashable
119
- # arguments (such as those to Tilt.new):
120
- #
121
- # cache = Tilt::Cache.new
122
- # cache.fetch(path, line, options) { Tilt.new(path, line, options) }
123
- #
124
- # Subsequent invocations return the already loaded template object.
125
- #
126
- # @note Tilt::Cache is a thin wrapper around Hash. It has the following
127
- # limitations:
128
- # * Not thread-safe.
129
- # * Size is unbounded.
130
- # * Keys are not copied defensively, and should not be modified after
131
- # being passed to #fetch. More specifically, the values returned by
132
- # key#hash and key#eql? should not change.
133
- # If this is too limiting for you, use a different cache implementation.
134
- #
135
- # source://tilt-2.0.11/lib/tilt.rb:91
136
- class Tilt::Cache
137
- # @return [Cache] a new instance of Cache
138
- #
139
- # source://tilt-2.0.11/lib/tilt.rb:92
140
- def initialize; end
141
-
142
- # Clears the cache.
143
- #
144
- # source://tilt-2.0.11/lib/tilt.rb:109
145
- def clear; end
146
-
147
- # Caches a value for key, or returns the previously cached value.
148
- # If a value has been previously cached for key then it is
149
- # returned. Otherwise, block is yielded to and its return value
150
- # which may be nil, is cached under key and returned.
151
- #
152
- # @yield
153
- # @yieldreturn the value to cache for key
154
- #
155
- # source://tilt-2.0.11/lib/tilt.rb:102
156
- def fetch(*key); end
157
- end
158
-
159
- # source://tilt-2.0.11/lib/tilt/template.rb:7
160
- module Tilt::CompiledTemplates; end
161
-
162
- # Used for detecting autoloading bug in JRuby
163
- #
164
- # source://tilt-2.0.11/lib/tilt/dummy.rb:2
165
- class Tilt::Dummy; end
166
-
167
- # ERB template implementation. See:
168
- # http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html
169
- #
170
- # source://tilt-2.0.11/lib/tilt/erb.rb:7
171
- class Tilt::ERBTemplate < ::Tilt::Template
172
- # source://tilt-2.0.11/lib/tilt/erb.rb:56
173
- def precompiled(locals); end
174
-
175
- # source://tilt-2.0.11/lib/tilt/erb.rb:44
176
- def precompiled_postamble(locals); end
177
-
178
- # source://tilt-2.0.11/lib/tilt/erb.rb:36
179
- def precompiled_preamble(locals); end
180
-
181
- # source://tilt-2.0.11/lib/tilt/erb.rb:31
182
- def precompiled_template(locals); end
183
-
184
- # source://tilt-2.0.11/lib/tilt/erb.rb:21
185
- def prepare; end
186
-
187
- class << self
188
- # source://tilt-2.0.11/lib/tilt/erb.rb:12
189
- def default_output_variable; end
190
-
191
- # source://tilt-2.0.11/lib/tilt/erb.rb:16
192
- def default_output_variable=(name); end
193
- end
194
- end
195
-
196
- # source://tilt-2.0.11/lib/tilt/erb.rb:10
197
- Tilt::ERBTemplate::SUPPORTS_KVARGS = T.let(T.unsafe(nil), Array)
198
-
199
- # source://tilt-2.0.11/lib/tilt/etanni.rb:4
200
- class Tilt::EtanniTemplate < ::Tilt::Template
201
- # source://tilt-2.0.11/lib/tilt/etanni.rb:22
202
- def precompiled(locals); end
203
-
204
- # source://tilt-2.0.11/lib/tilt/etanni.rb:18
205
- def precompiled_template(locals); end
206
-
207
- # source://tilt-2.0.11/lib/tilt/etanni.rb:5
208
- def prepare; end
209
- end
210
-
211
- # Haml template implementation. See:
212
- # http://haml.hamptoncatlin.com/
213
- #
214
- # source://tilt-2.0.11/lib/tilt/haml.rb:7
215
- class Tilt::HamlTemplate < ::Tilt::Template
216
- # @raise [ArgumentError]
217
- #
218
- # source://tilt-2.0.11/lib/tilt/haml.rb:22
219
- def evaluate(scope, locals, &block); end
220
-
221
- # Precompiled Haml source. Taken from the precompiled_with_ambles
222
- # method in Haml::Precompiler:
223
- # http://github.com/nex3/haml/blob/master/lib/haml/precompiler.rb#L111-126
224
- #
225
- # source://tilt-2.0.11/lib/tilt/haml.rb:27
226
- def precompiled_template(locals); end
227
-
228
- # Following definitions are for Haml <= 4 and deprecated.
229
- #
230
- # source://tilt-2.0.11/lib/tilt/haml.rb:12
231
- def prepare; end
232
- end
233
-
234
- # Kramdown Markdown implementation. See:
235
- # http://kramdown.rubyforge.org/
236
- #
237
- # source://tilt-2.0.11/lib/tilt/kramdown.rb:7
238
- class Tilt::KramdownTemplate < ::Tilt::Template
239
- # @return [Boolean]
240
- #
241
- # source://tilt-2.0.11/lib/tilt/kramdown.rb:20
242
- def allows_script?; end
243
-
244
- # source://tilt-2.0.11/lib/tilt/kramdown.rb:16
245
- def evaluate(scope, locals, &block); end
246
-
247
- # source://tilt-2.0.11/lib/tilt/kramdown.rb:10
248
- def prepare; end
249
- end
250
-
251
- # source://tilt-2.0.11/lib/tilt/kramdown.rb:8
252
- Tilt::KramdownTemplate::DUMB_QUOTES = T.let(T.unsafe(nil), Array)
253
-
254
- # @private
255
- #
256
- # source://tilt-2.0.11/lib/tilt/template.rb:16
257
- Tilt::LOCK = T.let(T.unsafe(nil), Thread::Mutex)
258
-
259
- # Tilt::Mapping associates file extensions with template implementations.
260
- #
261
- # mapping = Tilt::Mapping.new
262
- # mapping.register(Tilt::RDocTemplate, 'rdoc')
263
- # mapping['index.rdoc'] # => Tilt::RDocTemplate
264
- # mapping.new('index.rdoc').render
265
- #
266
- # You can use {#register} to register a template class by file
267
- # extension, {#registered?} to see if a file extension is mapped,
268
- # {#[]} to lookup template classes, and {#new} to instantiate template
269
- # objects.
270
- #
271
- # Mapping also supports *lazy* template implementations. Note that regularly
272
- # registered template implementations *always* have preference over lazily
273
- # registered template implementations. You should use {#register} if you
274
- # depend on a specific template implementation and {#register_lazy} if there
275
- # are multiple alternatives.
276
- #
277
- # mapping = Tilt::Mapping.new
278
- # mapping.register_lazy('RDiscount::Template', 'rdiscount/template', 'md')
279
- # mapping['index.md']
280
- # # => RDiscount::Template
281
- #
282
- # {#register_lazy} takes a class name, a filename, and a list of file
283
- # extensions. When you try to lookup a template name that matches the
284
- # file extension, Tilt will automatically try to require the filename and
285
- # constantize the class name.
286
- #
287
- # Unlike {#register}, there can be multiple template implementations
288
- # registered lazily to the same file extension. Tilt will attempt to load the
289
- # template implementations in order (registered *last* would be tried first),
290
- # returning the first which doesn't raise LoadError.
291
- #
292
- # If all of the registered template implementations fails, Tilt will raise
293
- # the exception of the first, since that was the most preferred one.
294
- #
295
- # mapping = Tilt::Mapping.new
296
- # mapping.register_lazy('Bluecloth::Template', 'bluecloth/template', 'md')
297
- # mapping.register_lazy('RDiscount::Template', 'rdiscount/template', 'md')
298
- # mapping['index.md']
299
- # # => RDiscount::Template
300
- #
301
- # In the previous example we say that RDiscount has a *higher priority* than
302
- # BlueCloth. Tilt will first try to `require "rdiscount/template"`, falling
303
- # back to `require "bluecloth/template"`. If none of these are successful,
304
- # the first error will be raised.
305
- #
306
- # source://tilt-2.0.11/lib/tilt/mapping.rb:50
307
- class Tilt::Mapping
308
- # @return [Mapping] a new instance of Mapping
309
- #
310
- # source://tilt-2.0.11/lib/tilt/mapping.rb:54
311
- def initialize; end
312
-
313
- # Looks up a template class based on file name and/or extension.
314
- #
315
- # @example
316
- # mapping['views/hello.erb'] # => Tilt::ERBTemplate
317
- # mapping['hello.erb'] # => Tilt::ERBTemplate
318
- # mapping['erb'] # => Tilt::ERBTemplate
319
- # @return [template class]
320
- #
321
- # source://tilt-2.0.11/lib/tilt/mapping.rb:152
322
- def [](file); end
323
-
324
- # Finds the extensions the template class has been registered under.
325
- #
326
- # @param template_class [template class]
327
- #
328
- # source://tilt-2.0.11/lib/tilt/mapping.rb:183
329
- def extensions_for(template_class); end
330
-
331
- # @private
332
- #
333
- # source://tilt-2.0.11/lib/tilt/mapping.rb:52
334
- def lazy_map; end
335
-
336
- # Instantiates a new template class based on the file.
337
- #
338
- # @example
339
- # mapping.new('index.mt') # => instance of MyEngine::Template
340
- # @raise [RuntimeError] if there is no template class registered for the
341
- # file name.
342
- # @see Tilt::Template.new
343
- #
344
- # source://tilt-2.0.11/lib/tilt/mapping.rb:136
345
- def new(file, line = T.unsafe(nil), options = T.unsafe(nil), &block); end
346
-
347
- # Registers a template implementation by file extension. There can only be
348
- # one template implementation per file extension, and this method will
349
- # override any existing mapping.
350
- #
351
- # @example
352
- # mapping.register MyEngine::Template, 'mt'
353
- # mapping['index.mt'] # => MyEngine::Template
354
- # @param template_class
355
- # @param extensions [Array<String>] List of extensions.
356
- # @return [void]
357
- #
358
- # source://tilt-2.0.11/lib/tilt/mapping.rb:104
359
- def register(template_class, *extensions); end
360
-
361
- # Registers a lazy template implementation by file extension. You
362
- # can have multiple lazy template implementations defined on the
363
- # same file extension, in which case the template implementation
364
- # defined *last* will be attempted loaded *first*.
365
- #
366
- # @example
367
- # mapping.register_lazy 'MyEngine::Template', 'my_engine/template', 'mt'
368
- #
369
- # defined?(MyEngine::Template) # => false
370
- # mapping['index.mt'] # => MyEngine::Template
371
- # defined?(MyEngine::Template) # => true
372
- # @param class_name [String] Class name of a template class.
373
- # @param file [String] Filename where the template class is defined.
374
- # @param extensions [Array<String>] List of extensions.
375
- # @return [void]
376
- #
377
- # source://tilt-2.0.11/lib/tilt/mapping.rb:81
378
- def register_lazy(class_name, file, *extensions); end
379
-
380
- # Checks if a file extension is registered (either eagerly or
381
- # lazily) in this mapping.
382
- #
383
- # @example
384
- # mapping.registered?('erb') # => true
385
- # mapping.registered?('nope') # => false
386
- # @param ext [String] File extension.
387
- # @return [Boolean]
388
- #
389
- # source://tilt-2.0.11/lib/tilt/mapping.rb:123
390
- def registered?(ext); end
391
-
392
- # Looks up a template class based on file name and/or extension.
393
- #
394
- # @example
395
- # mapping['views/hello.erb'] # => Tilt::ERBTemplate
396
- # mapping['hello.erb'] # => Tilt::ERBTemplate
397
- # mapping['erb'] # => Tilt::ERBTemplate
398
- # @return [template class]
399
- #
400
- # source://tilt-2.0.11/lib/tilt/mapping.rb:152
401
- def template_for(file); end
402
-
403
- # @private
404
- #
405
- # source://tilt-2.0.11/lib/tilt/mapping.rb:52
406
- def template_map; end
407
-
408
- # Looks up a list of template classes based on file name. If the file name
409
- # has multiple extensions, it will return all template classes matching the
410
- # extensions from the end.
411
- #
412
- # @example
413
- # mapping.templates_for('views/index.haml.erb')
414
- # # => [Tilt::ERBTemplate, Tilt::HamlTemplate]
415
- # @return [Array<template class>]
416
- #
417
- # source://tilt-2.0.11/lib/tilt/mapping.rb:168
418
- def templates_for(file); end
419
-
420
- private
421
-
422
- # The proper behavior (in MRI) for autoload? is to
423
- # return `false` when the constant/file has been
424
- # explicitly required.
425
- #
426
- # However, in JRuby it returns `true` even after it's
427
- # been required. In that case it turns out that `defined?`
428
- # returns `"constant"` if it exists and `nil` when it doesn't.
429
- # This is actually a second bug: `defined?` should resolve
430
- # autoload (aka. actually try to require the file).
431
- #
432
- # We use the second bug in order to resolve the first bug.
433
- #
434
- # @return [Boolean]
435
- #
436
- # source://tilt-2.0.11/lib/tilt/mapping.rb:277
437
- def constant_defined?(name); end
438
-
439
- # @private
440
- #
441
- # source://tilt-2.0.11/lib/tilt/mapping.rb:60
442
- def initialize_copy(other); end
443
-
444
- # @return [Boolean]
445
- #
446
- # source://tilt-2.0.11/lib/tilt/mapping.rb:196
447
- def lazy?(ext); end
448
-
449
- # source://tilt-2.0.11/lib/tilt/mapping.rb:221
450
- def lazy_load(pattern); end
451
-
452
- # source://tilt-2.0.11/lib/tilt/mapping.rb:215
453
- def lookup(ext); end
454
-
455
- # source://tilt-2.0.11/lib/tilt/mapping.rb:201
456
- def split(file); end
457
- end
458
-
459
- # source://tilt-2.0.11/lib/tilt/mapping.rb:219
460
- Tilt::Mapping::LOCK = T.let(T.unsafe(nil), Monitor)
461
-
462
- # Nokogiri template implementation. See:
463
- # http://nokogiri.org/
464
- #
465
- # source://tilt-2.0.11/lib/tilt/nokogiri.rb:7
466
- class Tilt::NokogiriTemplate < ::Tilt::Template
467
- # source://tilt-2.0.11/lib/tilt/nokogiri.rb:13
468
- def evaluate(scope, locals); end
469
-
470
- # source://tilt-2.0.11/lib/tilt/nokogiri.rb:27
471
- def precompiled_postamble(locals); end
472
-
473
- # source://tilt-2.0.11/lib/tilt/nokogiri.rb:22
474
- def precompiled_preamble(locals); end
475
-
476
- # source://tilt-2.0.11/lib/tilt/nokogiri.rb:31
477
- def precompiled_template(locals); end
478
-
479
- # source://tilt-2.0.11/lib/tilt/nokogiri.rb:11
480
- def prepare; end
481
- end
482
-
483
- # source://tilt-2.0.11/lib/tilt/nokogiri.rb:8
484
- Tilt::NokogiriTemplate::DOCUMENT_HEADER = T.let(T.unsafe(nil), Regexp)
485
-
486
- # Raw text (no template functionality).
487
- #
488
- # source://tilt-2.0.11/lib/tilt/plain.rb:6
489
- class Tilt::PlainTemplate < ::Tilt::Template
490
- # source://tilt-2.0.11/lib/tilt/plain.rb:12
491
- def evaluate(scope, locals, &block); end
492
-
493
- # source://tilt-2.0.11/lib/tilt/plain.rb:9
494
- def prepare; end
495
- end
496
-
497
- # RDoc template. See:
498
- # http://rdoc.rubyforge.org/
499
- #
500
- # It's suggested that your program `require 'rdoc/markup'` and
501
- # `require 'rdoc/markup/to_html'` at load time when using this template
502
- # engine in a threaded environment.
503
- #
504
- # source://tilt-2.0.11/lib/tilt/rdoc.rb:13
505
- class Tilt::RDocTemplate < ::Tilt::Template
506
- # @return [Boolean]
507
- #
508
- # source://tilt-2.0.11/lib/tilt/rdoc.rb:36
509
- def allows_script?; end
510
-
511
- # source://tilt-2.0.11/lib/tilt/rdoc.rb:32
512
- def evaluate(scope, locals, &block); end
513
-
514
- # source://tilt-2.0.11/lib/tilt/rdoc.rb:16
515
- def markup; end
516
-
517
- # source://tilt-2.0.11/lib/tilt/rdoc.rb:27
518
- def prepare; end
519
- end
520
-
521
- # Standalone string interpolator and template processor implementation in Go.
522
- # see: https://github.com/gliderlabs/sigil
523
- #
524
- # source://tilt-2.0.11/lib/tilt/sigil.rb:7
525
- class Tilt::SigilTemplate < ::Tilt::Template
526
- # @return [Boolean]
527
- #
528
- # source://tilt-2.0.11/lib/tilt/sigil.rb:30
529
- def allows_script?; end
530
-
531
- # source://tilt-2.0.11/lib/tilt/sigil.rb:11
532
- def evaluate(scope, locals, &block); end
533
-
534
- # source://tilt-2.0.11/lib/tilt/sigil.rb:8
535
- def prepare; end
536
- end
537
-
538
- # The template source is evaluated as a Ruby string. The #{} interpolation
539
- # syntax can be used to generated dynamic output.
540
- #
541
- # source://tilt-2.0.11/lib/tilt/string.rb:6
542
- class Tilt::StringTemplate < ::Tilt::Template
543
- # source://tilt-2.0.11/lib/tilt/string.rb:16
544
- def precompiled(locals); end
545
-
546
- # source://tilt-2.0.11/lib/tilt/string.rb:12
547
- def precompiled_template(locals); end
548
-
549
- # source://tilt-2.0.11/lib/tilt/string.rb:7
550
- def prepare; end
551
- end
552
-
553
- # @private
554
- #
555
- # source://tilt-2.0.11/lib/tilt/template.rb:5
556
- Tilt::TOPOBJECT = Tilt::CompiledTemplates
557
-
558
- # Base class for template implementations. Subclasses must implement
559
- # the #prepare method and one of the #evaluate or #precompiled_template
560
- # methods.
561
- #
562
- # source://tilt-2.0.11/lib/tilt/template.rb:21
563
- class Tilt::Template
564
- # Create a new template with the file, line, and options specified. By
565
- # default, template data is read from the file. When a block is given,
566
- # it should read template data and return as a String. When file is nil,
567
- # a block is required.
568
- #
569
- # All arguments are optional.
570
- #
571
- # @raise [ArgumentError]
572
- # @return [Template] a new instance of Template
573
- #
574
- # source://tilt-2.0.11/lib/tilt/template.rb:60
575
- def initialize(file = T.unsafe(nil), line = T.unsafe(nil), options = T.unsafe(nil), &block); end
576
-
577
- # The basename of the template file.
578
- #
579
- # source://tilt-2.0.11/lib/tilt/template.rb:115
580
- def basename(suffix = T.unsafe(nil)); end
581
-
582
- # Template source; loaded from a file or given directly.
583
- #
584
- # source://tilt-2.0.11/lib/tilt/template.rb:23
585
- def data; end
586
-
587
- # The filename used in backtraces to describe the template.
588
- #
589
- # source://tilt-2.0.11/lib/tilt/template.rb:125
590
- def eval_file; end
591
-
592
- # The name of the file where the template data was loaded from.
593
- #
594
- # source://tilt-2.0.11/lib/tilt/template.rb:26
595
- def file; end
596
-
597
- # The line number in #file where template data was loaded from.
598
- #
599
- # source://tilt-2.0.11/lib/tilt/template.rb:29
600
- def line; end
601
-
602
- # An empty Hash that the template engine can populate with various
603
- # metadata.
604
- #
605
- # source://tilt-2.0.11/lib/tilt/template.rb:131
606
- def metadata; end
607
-
608
- # The template file's basename with all extensions chomped off.
609
- #
610
- # source://tilt-2.0.11/lib/tilt/template.rb:120
611
- def name; end
612
-
613
- # A Hash of template engine specific options. This is passed directly
614
- # to the underlying engine and is not used by the generic template
615
- # interface.
616
- #
617
- # source://tilt-2.0.11/lib/tilt/template.rb:34
618
- def options; end
619
-
620
- # Render the template in the given scope with the locals specified. If a
621
- # block is given, it is typically available within the template via
622
- # +yield+.
623
- #
624
- # source://tilt-2.0.11/lib/tilt/template.rb:105
625
- def render(scope = T.unsafe(nil), locals = T.unsafe(nil), &block); end
626
-
627
- protected
628
-
629
- # The encoding of the source data. Defaults to the
630
- # default_encoding-option if present. You may override this method
631
- # in your template class if you have a better hint of the data's
632
- # encoding.
633
- #
634
- # source://tilt-2.0.11/lib/tilt/template.rb:147
635
- def default_encoding; end
636
-
637
- # Execute the compiled template and return the result string. Template
638
- # evaluation is guaranteed to be performed in the scope object with the
639
- # locals specified and with support for yielding to the block.
640
- #
641
- # This method is only used by source generating templates. Subclasses that
642
- # override render() may not support all features.
643
- #
644
- # source://tilt-2.0.11/lib/tilt/template.rb:168
645
- def evaluate(scope, locals, &block); end
646
-
647
- # Generates all template source by combining the preamble, template, and
648
- # postamble and returns a two-tuple of the form: [source, offset], where
649
- # source is the string containing (Ruby) source code for the template and
650
- # offset is the integer line offset where line reporting should begin.
651
- #
652
- # Template subclasses may override this method when they need complete
653
- # control over source generation or want to adjust the default line
654
- # offset. In most cases, overriding the #precompiled_template method is
655
- # easier and more appropriate.
656
- #
657
- # source://tilt-2.0.11/lib/tilt/template.rb:193
658
- def precompiled(local_keys); end
659
-
660
- # source://tilt-2.0.11/lib/tilt/template.rb:227
661
- def precompiled_postamble(local_keys); end
662
-
663
- # source://tilt-2.0.11/lib/tilt/template.rb:223
664
- def precompiled_preamble(local_keys); end
665
-
666
- # A string containing the (Ruby) source code for the template. The
667
- # default Template#evaluate implementation requires either this
668
- # method or the #precompiled method be overridden. When defined,
669
- # the base Template guarantees correct file/line handling, locals
670
- # support, custom scopes, proper encoding, and support for template
671
- # compilation.
672
- #
673
- # @raise [NotImplementedError]
674
- #
675
- # source://tilt-2.0.11/lib/tilt/template.rb:219
676
- def precompiled_template(local_keys); end
677
-
678
- # Do whatever preparation is necessary to setup the underlying template
679
- # engine. Called immediately after template data is loaded. Instance
680
- # variables set in this method are available when #evaluate is called.
681
- #
682
- # Subclasses must provide an implementation of this method.
683
- #
684
- # @raise [NotImplementedError]
685
- #
686
- # source://tilt-2.0.11/lib/tilt/template.rb:156
687
- def prepare; end
688
-
689
- private
690
-
691
- # source://tilt-2.0.11/lib/tilt/template.rb:300
692
- def binary(string); end
693
-
694
- # source://tilt-2.0.11/lib/tilt/template.rb:261
695
- def compile_template_method(local_keys, scope_class = T.unsafe(nil)); end
696
-
697
- # The compiled method for the locals keys provided.
698
- #
699
- # source://tilt-2.0.11/lib/tilt/template.rb:245
700
- def compiled_method(locals_keys, scope_class = T.unsafe(nil)); end
701
-
702
- # source://tilt-2.0.11/lib/tilt/template.rb:290
703
- def extract_encoding(script); end
704
-
705
- # source://tilt-2.0.11/lib/tilt/template.rb:294
706
- def extract_magic_comment(script); end
707
-
708
- # source://tilt-2.0.11/lib/tilt/template.rb:251
709
- def local_extraction(local_keys); end
710
-
711
- # source://tilt-2.0.11/lib/tilt/template.rb:235
712
- def read_template_file; end
713
-
714
- # source://tilt-2.0.11/lib/tilt/template.rb:284
715
- def unbind_compiled_method(method_name); end
716
-
717
- class << self
718
- # @deprecated Use `.metadata[:mime_type]` instead.
719
- #
720
- # source://tilt-2.0.11/lib/tilt/template.rb:44
721
- def default_mime_type; end
722
-
723
- # @deprecated Use `.metadata[:mime_type] = val` instead.
724
- #
725
- # source://tilt-2.0.11/lib/tilt/template.rb:49
726
- def default_mime_type=(value); end
727
-
728
- # An empty Hash that the template engine can populate with various
729
- # metadata.
730
- #
731
- # source://tilt-2.0.11/lib/tilt/template.rb:39
732
- def metadata; end
733
- end
734
- end
735
-
736
- # source://tilt-2.0.11/lib/tilt/template.rb:160
737
- Tilt::Template::CLASS_METHOD = T.let(T.unsafe(nil), UnboundMethod)
738
-
739
- # Current version.
740
- #
741
- # source://tilt-2.0.11/lib/tilt.rb:7
742
- Tilt::VERSION = T.let(T.unsafe(nil), String)