rails-rfc6570 3.3.0 → 3.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 (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +3 -1
  4. data/lib/rails/rfc6570/formatter.rb +9 -12
  5. data/lib/rails/rfc6570/patches.rb +1 -1
  6. data/lib/rails/rfc6570/version.rb +1 -1
  7. data/lib/rails/rfc6570.rb +10 -29
  8. data/spec/dummy/config/application.rb +5 -1
  9. data/spec/dummy/config/environments/test.rb +1 -1
  10. data/spec/rails/rfc6570/extensions/route_set_spec.rb +29 -0
  11. data/spec/rails/rfc6570/helper_spec.rb +44 -0
  12. data/spec/rails/rfc6570/visitor_spec.rb +12 -0
  13. data/spec/rails/rfc6570_spec.rb +49 -1
  14. data/spec/spec_helper.rb +6 -0
  15. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-3bcd2110ca87/LICENSE +21 -0
  16. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-3bcd2110ca87/README.md +23 -0
  17. data/vendor/bundle/ruby/3.4.0/bundler/gems/rubocop-config-3bcd2110ca87/rubocop-config.gemspec +31 -0
  18. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.3/CHANGELOG.md +285 -0
  19. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.3/MIT-LICENSE +21 -0
  20. data/vendor/bundle/ruby/3.4.0/gems/actionpack-8.0.3/README.rdoc +57 -0
  21. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.3/CHANGELOG.md +129 -0
  22. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.3/MIT-LICENSE +21 -0
  23. data/vendor/bundle/ruby/3.4.0/gems/actionview-8.0.3/README.rdoc +40 -0
  24. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.3/CHANGELOG.md +309 -0
  25. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.3/MIT-LICENSE +20 -0
  26. data/vendor/bundle/ruby/3.4.0/gems/activesupport-8.0.3/README.rdoc +40 -0
  27. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/CHANGELOG.md +301 -0
  28. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/LICENSE.txt +202 -0
  29. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/README.md +121 -0
  30. data/vendor/bundle/ruby/3.4.0/gems/addressable-2.8.7/addressable.gemspec +28 -0
  31. data/vendor/bundle/ruby/3.4.0/gems/base64-0.3.0/README.md +48 -0
  32. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.1/README.md +138 -0
  33. data/vendor/bundle/ruby/3.4.0/gems/benchmark-0.4.1/benchmark.gemspec +32 -0
  34. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.2.3/LICENSE +56 -0
  35. data/vendor/bundle/ruby/3.4.0/gems/bigdecimal-3.2.3/bigdecimal.gemspec +57 -0
  36. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/MIT-LICENSE +20 -0
  37. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/README.md +258 -0
  38. data/vendor/bundle/ruby/3.4.0/gems/builder-3.3.0/builder.gemspec +49 -0
  39. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/CHANGELOG.md +603 -0
  40. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/LICENSE.txt +21 -0
  41. data/vendor/bundle/ruby/3.4.0/gems/concurrent-ruby-1.3.5/README.md +407 -0
  42. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.4/LICENSE +20 -0
  43. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.4/README.md +188 -0
  44. data/vendor/bundle/ruby/3.4.0/gems/connection_pool-2.5.4/connection_pool.gemspec +24 -0
  45. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/LICENSE +18 -0
  46. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/README.md +192 -0
  47. data/vendor/bundle/ruby/3.4.0/gems/crass-1.0.6/crass.gemspec +31 -0
  48. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.6.2/CHANGELOG.md +518 -0
  49. data/vendor/bundle/ruby/3.4.0/gems/diff-lcs-1.6.2/README.md +92 -0
  50. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.3/LICENSE.txt +22 -0
  51. data/vendor/bundle/ruby/3.4.0/gems/drb-2.2.3/drb.gemspec +42 -0
  52. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/CHANGELOG +111 -0
  53. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/MIT-LICENSE +21 -0
  54. data/vendor/bundle/ruby/3.4.0/gems/erubi-1.13.1/README.rdoc +151 -0
  55. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/MIT-LICENSE +20 -0
  56. data/vendor/bundle/ruby/3.4.0/gems/i18n-1.14.7/README.md +127 -0
  57. data/vendor/bundle/ruby/3.4.0/gems/logger-1.7.0/README.md +104 -0
  58. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.1/CHANGELOG.md +598 -0
  59. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.1/MIT-LICENSE.txt +23 -0
  60. data/vendor/bundle/ruby/3.4.0/gems/loofah-2.24.1/README.md +410 -0
  61. data/vendor/bundle/ruby/3.4.0/gems/minitest-5.25.5/README.rdoc +842 -0
  62. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.10-x86_64-linux-gnu/LICENSE-DEPENDENCIES.md +2224 -0
  63. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.10-x86_64-linux-gnu/LICENSE.md +9 -0
  64. data/vendor/bundle/ruby/3.4.0/gems/nokogiri-1.18.10-x86_64-linux-gnu/README.md +293 -0
  65. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/CHANGELOG.md +498 -0
  66. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/LICENSE.txt +22 -0
  67. data/vendor/bundle/ruby/3.4.0/gems/public_suffix-6.0.2/README.md +222 -0
  68. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.ja.rdoc +58 -0
  69. data/vendor/bundle/ruby/3.4.0/gems/racc-1.8.1/README.rdoc +60 -0
  70. data/vendor/bundle/ruby/3.4.0/gems/rack-3.2.1/CHANGELOG.md +1236 -0
  71. data/vendor/bundle/ruby/3.4.0/gems/rack-3.2.1/MIT-LICENSE +20 -0
  72. data/vendor/bundle/ruby/3.4.0/gems/rack-3.2.1/README.md +376 -0
  73. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/MIT-LICENSE.txt +20 -0
  74. data/vendor/bundle/ruby/3.4.0/gems/rack-test-2.2.0/README.md +139 -0
  75. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.3.0/MIT-LICENSE +23 -0
  76. data/vendor/bundle/ruby/3.4.0/gems/rails-dom-testing-2.3.0/README.md +94 -0
  77. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/CHANGELOG.md +255 -0
  78. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/MIT-LICENSE +23 -0
  79. data/vendor/bundle/ruby/3.4.0/gems/rails-html-sanitizer-1.6.2/README.md +267 -0
  80. data/vendor/bundle/ruby/3.4.0/gems/rake-13.3.0/MIT-LICENSE +21 -0
  81. data/vendor/bundle/ruby/3.4.0/gems/rake-13.3.0/README.rdoc +155 -0
  82. data/vendor/bundle/ruby/3.4.0/gems/rake-13.3.0/rake.gemspec +101 -0
  83. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/LICENSE +21 -0
  84. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/README.md +107 -0
  85. data/vendor/bundle/ruby/3.4.0/gems/rake-release-1.3.0/rake-release.gemspec +23 -0
  86. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.1/LICENSE.md +27 -0
  87. data/vendor/bundle/ruby/3.4.0/gems/rspec-3.13.1/README.md +47 -0
  88. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.5/LICENSE.md +26 -0
  89. data/vendor/bundle/ruby/3.4.0/gems/rspec-core-3.13.5/README.md +389 -0
  90. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.5/LICENSE.md +25 -0
  91. data/vendor/bundle/ruby/3.4.0/gems/rspec-expectations-3.13.5/README.md +326 -0
  92. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.5/LICENSE.md +25 -0
  93. data/vendor/bundle/ruby/3.4.0/gems/rspec-mocks-3.13.5/README.md +465 -0
  94. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.6/LICENSE.md +23 -0
  95. data/vendor/bundle/ruby/3.4.0/gems/rspec-support-3.13.6/README.md +40 -0
  96. data/vendor/bundle/ruby/3.4.0/gems/securerandom-0.4.1/README.md +72 -0
  97. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/LICENSE +19 -0
  98. data/vendor/bundle/ruby/3.4.0/gems/tzinfo-2.0.6/README.md +406 -0
  99. data/vendor/bundle/ruby/3.4.0/gems/uri-1.0.3/README.md +55 -0
  100. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/LICENSE +20 -0
  101. data/vendor/bundle/ruby/3.4.0/gems/useragent-0.16.11/README.md +42 -0
  102. data/vendor/bundle/ruby/3.4.0/specifications/actionpack-8.0.3.gemspec +36 -0
  103. data/vendor/bundle/ruby/3.4.0/specifications/actionview-8.0.3.gemspec +33 -0
  104. data/vendor/bundle/ruby/3.4.0/specifications/activesupport-8.0.3.gemspec +38 -0
  105. data/vendor/bundle/ruby/3.4.0/specifications/addressable-2.8.7.gemspec +30 -0
  106. data/vendor/bundle/ruby/3.4.0/specifications/base64-0.3.0.gemspec +23 -0
  107. data/vendor/bundle/ruby/3.4.0/specifications/benchmark-0.4.1.gemspec +23 -0
  108. data/vendor/bundle/ruby/3.4.0/specifications/bigdecimal-3.2.3.gemspec +25 -0
  109. data/vendor/bundle/ruby/3.4.0/specifications/builder-3.3.0.gemspec +22 -0
  110. data/vendor/bundle/ruby/3.4.0/specifications/concurrent-ruby-1.3.5.gemspec +24 -0
  111. data/vendor/bundle/ruby/3.4.0/specifications/connection_pool-2.5.4.gemspec +28 -0
  112. data/vendor/bundle/ruby/3.4.0/specifications/crass-1.0.6.gemspec +27 -0
  113. data/vendor/bundle/ruby/3.4.0/specifications/diff-lcs-1.6.2.gemspec +35 -0
  114. data/vendor/bundle/ruby/3.4.0/specifications/drb-2.2.3.gemspec +22 -0
  115. data/vendor/bundle/ruby/3.4.0/specifications/erubi-1.13.1.gemspec +29 -0
  116. data/vendor/bundle/ruby/3.4.0/specifications/i18n-1.14.7.gemspec +26 -0
  117. data/vendor/bundle/ruby/3.4.0/specifications/logger-1.7.0.gemspec +22 -0
  118. data/vendor/bundle/ruby/3.4.0/specifications/loofah-2.24.1.gemspec +27 -0
  119. data/vendor/bundle/ruby/3.4.0/specifications/minitest-5.25.5.gemspec +31 -0
  120. data/vendor/bundle/ruby/3.4.0/specifications/nokogiri-1.18.10-x86_64-linux-gnu.gemspec +31 -0
  121. data/vendor/bundle/ruby/3.4.0/specifications/public_suffix-6.0.2.gemspec +24 -0
  122. data/vendor/bundle/ruby/3.4.0/specifications/racc-1.8.1.gemspec +28 -0
  123. data/vendor/bundle/ruby/3.4.0/specifications/rack-3.2.1.gemspec +31 -0
  124. data/vendor/bundle/ruby/3.4.0/specifications/rack-session-2.1.1.gemspec +30 -0
  125. data/vendor/bundle/ruby/3.4.0/specifications/rack-test-2.2.0.gemspec +29 -0
  126. data/vendor/bundle/ruby/3.4.0/specifications/rails-dom-testing-2.3.0.gemspec +28 -0
  127. data/vendor/bundle/ruby/3.4.0/specifications/rails-html-sanitizer-1.6.2.gemspec +27 -0
  128. data/vendor/bundle/ruby/3.4.0/specifications/rake-13.3.0.gemspec +26 -0
  129. data/vendor/bundle/ruby/3.4.0/specifications/rake-release-1.3.0.gemspec +26 -0
  130. data/vendor/bundle/ruby/3.4.0/specifications/rspec-3.13.1.gemspec +31 -0
  131. data/vendor/bundle/ruby/3.4.0/specifications/rspec-core-3.13.5.gemspec +31 -0
  132. data/vendor/bundle/ruby/3.4.0/specifications/rspec-expectations-3.13.5.gemspec +29 -0
  133. data/vendor/bundle/ruby/3.4.0/specifications/rspec-mocks-3.13.5.gemspec +29 -0
  134. data/vendor/bundle/ruby/3.4.0/specifications/rspec-support-3.13.6.gemspec +29 -0
  135. data/vendor/bundle/ruby/3.4.0/specifications/securerandom-0.4.1.gemspec +23 -0
  136. data/vendor/bundle/ruby/3.4.0/specifications/tzinfo-2.0.6.gemspec +30 -0
  137. data/vendor/bundle/ruby/3.4.0/specifications/uri-1.0.3.gemspec +23 -0
  138. data/vendor/bundle/ruby/3.4.0/specifications/useragent-0.16.11.gemspec +25 -0
  139. metadata +129 -8
  140. data/spec/dummy/log/test.log +0 -432
@@ -0,0 +1,111 @@
1
+ === 1.13.1 (2024-12-19)
2
+
3
+ * Avoid spurious frozen string literal warnings for chilled strings when using Ruby 3.4 (jeremyevans)
4
+
5
+ === 1.13.0 (2024-06-13)
6
+
7
+ * Define Erubi.h as a module function (jeremyevans)
8
+
9
+ * Add erubi/capture_block, supporting capturing block output via standard <%= and <%== tags (jeremyevans)
10
+
11
+ === 1.12.0 (2022-12-22)
12
+
13
+ * Use erb/escape for faster html escaping if available (jeremyevans)
14
+
15
+ * Default :freeze_template_literals option to false if running with --enable-frozen-string-literal (casperisfine) (#35)
16
+
17
+ === 1.11.0 (2022-08-02)
18
+
19
+ * Support :freeze_template_literals option for configuring whether to add .freeze to template literal strings (casperisfine) (#33)
20
+
21
+ * Support :chain_appends option for chaining appends to the buffer variable (casperisfine, jeremyevans) (#32)
22
+
23
+ * Avoid unnecessary defined? usage on Ruby 3+ when using the :ensure option (jeremyevans)
24
+
25
+ === 1.10.0 (2020-11-13)
26
+
27
+ * Improve template parsing, mostly by reducing allocations (jeremyevans)
28
+
29
+ * Do not ship tests in the gem, reducing gem size about 20% (jeremyevans)
30
+
31
+ * Support :literal_prefix and :literal_postfix options for how to output literal tags (e.g. <%% code %>) (jaredcwhite) (#26, #27)
32
+
33
+ === 1.9.0 (2019-09-25)
34
+
35
+ * Change default :bufvar from 'String.new' to '::String.new' to work with BasicObject (jeremyevans)
36
+
37
+ === 1.8.0 (2018-12-18)
38
+
39
+ * Support :yield_returns_buffer option in capture_end for always returning the (potentially modified) buffer in <%|= tags (evanleck) (#15)
40
+
41
+ === 1.7.1 (2018-03-05)
42
+
43
+ * Make whitespace handling for <%# %> tags more compatible with Erubis (jeremyevans) (#14)
44
+
45
+ === 1.7.0 (2017-10-09)
46
+
47
+ * Fix escaping in erubi/capture_end, the setting was previously inverted (jeremyevans) (#10)
48
+
49
+ === 1.6.1 (2017-06-27)
50
+
51
+ * Fix usage on newer versions of JRuby 9.1 (jeremyevans)
52
+
53
+ === 1.6.0 (2017-02-27)
54
+
55
+ * Use cgi/escape if available for 6x faster HTML escaping (k0kubun, jeremyevans) (#4)
56
+
57
+ === 1.5.0 (2017-01-26)
58
+
59
+ * Drop tilt/erubi file, as tilt now ships with Erubi support (jeremyevans)
60
+
61
+ * Drop erubi/capture file, Erubi::CaptureEngine support (jeremyevans)
62
+
63
+ === 1.4.0 (2017-01-20)
64
+
65
+ * Allow postambles to depend on internal state of engine (jeremyevans)
66
+
67
+ * Allow overriding of behavior for <%= and <%== tags to depend on which indicator was used (jeremyevans)
68
+
69
+ * Make whitespace handling for <% %> tags more compatible with Erubis for subclasses overriding add_text (jeremyevans)
70
+
71
+ === 1.3.0 (2016-12-29)
72
+
73
+ * Support :capture=>:explicit option in tilt support to use Erubi::CaptureEndEngine (jeremyevans)
74
+
75
+ * Add erubi/capture_end containing Erubi::CaptureEndEngine, allowing <%|= and <%|== for opening capture tags, and <%| for closing capture tags (jeremyevans)
76
+
77
+ === 1.2.1 (2016-11-21)
78
+
79
+ * Don't automatically freeze template text strings on ruby 1.9 or 2.0 (jeremyevans)
80
+
81
+ === 1.2.0 (2016-11-21)
82
+
83
+ * Engine#src now returns a frozen string (jeremyevans)
84
+
85
+ * Automatically freeze template text strings on ruby 2.1+, reducing garbage generated (jeremyevans)
86
+
87
+ * Allow overriding of behavior for <%= and <%== tags (ujifgc) (#1)
88
+
89
+ === 1.1.0 (2016-11-14)
90
+
91
+ * Add :ensure option to supporting restoring bufvar to original value (jeremyevans)
92
+
93
+ * Don't have tilt support require erb (jeremyevans)
94
+
95
+ * Support :engine_class option in tilt support to override engine class used (jeremyevans)
96
+
97
+ * Support :capture option in tilt support to use Erubi::CaptureEngine (jeremyevans)
98
+
99
+ * Add erubi/capture file containing Erubi::CaptureEngine, allowing <%|= and <%|== for capture (and escaping) blocks in templates (jeremyevans)
100
+
101
+ * Raise ArgumentError if template source code contains indicators matched by regexp but not handled (jeremyevans)
102
+
103
+ * Add :bufval option to support arbitrary buffer values (jeremyevans)
104
+
105
+ * Add :regexp option to specify regexp used for scanning (jeremyevans)
106
+
107
+ * Add :src option to specify initial template source (jeremyevans)
108
+
109
+ === 1.0.0 (2016-11-10)
110
+
111
+ * Initial Public Release
@@ -0,0 +1,21 @@
1
+ copyright(c) 2006-2011 kuwata-lab.com all rights reserved.
2
+ copyright(c) 2016-2021 Jeremy Evans
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,151 @@
1
+ = Erubi
2
+
3
+ Erubi is a ERB template engine for ruby. It is a simplified fork of Erubis, using
4
+ the same basic algorithm, with the following differences:
5
+
6
+ * Handles postfix conditionals when using escaping (e.g. <tt><%= foo if bar %></tt>)
7
+ * Supports frozen_string_literal: true in templates via :freeze option
8
+ * Works with ruby's <tt>--enable-frozen-string-literal</tt> option
9
+ * Automatically freezes strings for template text when ruby optimizes it (on ruby 2.1+)
10
+ * Escapes <tt>'</tt> (apostrophe) when escaping for better XSS protection
11
+ * Has 15x-6x faster escaping by using erb/escape or cgi/escape
12
+ * Has 81% smaller memory footprint (calculated using +ObjectSpace.memsize_of_all+)
13
+ * Does no monkey patching (Erubis adds a method to Kernel)
14
+ * Uses an immutable design (all options passed to the constructor, which returns a frozen object)
15
+ * Has simpler internals (1 file, <150 lines of code)
16
+ * Is not dead (Erubis hasn't been updated since 2011)
17
+
18
+ It is not designed with Erubis API compatibility in mind, though most Erubis
19
+ ERB syntax works, with the following exceptions:
20
+
21
+ * No support for <tt><%===</tt> for debug output
22
+
23
+ = Installation
24
+
25
+ gem install erubi
26
+
27
+ = Source Code
28
+
29
+ Source code is available on GitHub at https://github.com/jeremyevans/erubi
30
+
31
+ = Usage
32
+
33
+ Erubi only has built in support for retrieving the generated source for a
34
+ file:
35
+
36
+ require 'erubi'
37
+ eval(Erubi::Engine.new(File.read('filename.erb')).src)
38
+
39
+ Most users will probably use Erubi via Rails or Tilt. Erubi is the default
40
+ erb template handler in Tilt 2.0.6+ and Rails 5.1+.
41
+
42
+ == Capturing
43
+
44
+ Erubi does not support capturing block output into the template by default.
45
+ It currently ships with two implementations that allow it.
46
+
47
+ === Erubi::CaptureBlockEngine
48
+
49
+ The recommended implementation can be required via +erubi/capture_block+,
50
+ which allows capturing to work with normal <tt><%=</tt> and <tt><%==</tt>
51
+ tags.
52
+
53
+ <%= form do %>
54
+ <input>
55
+ <% end %>
56
+
57
+ When using the capture_block support, capture methods should just return
58
+ the text it emit into the template, and call +capture+ on the buffer value.
59
+ Since the buffer variable is a local variable and not an instance variable
60
+ by default, you'll probably want to set the +:bufvar+ variable when using
61
+ the capture_block support to an instance variable, and have any methods
62
+ used call capture on that instance variable. Example:
63
+
64
+ def form(&block)
65
+ "<form>#{@_buf.capture(&block)}</form>"
66
+ end
67
+
68
+ puts eval(Erubi::CaptureBlockEngine.new(<<-END, bufvar: '@_buf', trim: false).src)
69
+ before
70
+ <%= form do %>
71
+ inside
72
+ <% end %>
73
+ after
74
+ END
75
+
76
+ # Output:
77
+ # before
78
+ # <form>
79
+ # inside
80
+ # </form>
81
+ # after
82
+
83
+ To use the capture_block support with tilt:
84
+
85
+ require 'tilt'
86
+ require 'erubi/capture_block'
87
+ Tilt.new("filename.erb", :engine_class=>Erubi::CaptureBlockEngine).render
88
+
89
+ Note that the capture_block support, while very compatible with the default
90
+ support, is not 100% compatible. One area where behavior differs is when
91
+ using multiple statements inside <tt><%=</tt> and <tt><%==</tt> tags:
92
+
93
+ <%= 1; 2 %>
94
+
95
+ The default support will output 2, but the capture_block support will output
96
+ 1.
97
+
98
+ === Erubi::CaptureEndEngine
99
+
100
+ An alternative capture implementation can be required via +erubi/capture_end+,
101
+ which supports it via <tt><%|=</tt> and <tt><%|==</tt> tags which are
102
+ closed with a <tt><%|</tt> tag:
103
+
104
+ <%|= form do %>
105
+ <input>
106
+ <%| end %>
107
+
108
+ It is only recommended to use +erubi/capture_end+ for backwards
109
+ compatibilty.
110
+
111
+ When using the capture_end support, capture methods (such as +form+ in the example
112
+ above) should return the (potentially modified) buffer. Similar to the
113
+ capture_block support, using an instance variable is recommended. Example:
114
+
115
+ def form
116
+ @_buf << "<form>"
117
+ yield
118
+ @_buf << "</form>"
119
+ @_buf
120
+ end
121
+
122
+ puts eval(Erubi::CaptureEndEngine.new(<<-END, bufvar: '@_buf').src)
123
+ before
124
+ <%|= form do %>
125
+ inside
126
+ <%| end %>
127
+ after
128
+ END
129
+
130
+ # Output:
131
+ # before
132
+ # <form>
133
+ # inside
134
+ # </form>
135
+ # after
136
+
137
+ Alternatively, passing the option <tt>:yield_returns_buffer => true</tt> will return the
138
+ buffer captured by the block instead of the last expression in the block.
139
+
140
+ = Reporting Bugs
141
+
142
+ The bug tracker is located at https://github.com/jeremyevans/erubi/issues
143
+
144
+ = License
145
+
146
+ MIT
147
+
148
+ = Authors
149
+
150
+ Jeremy Evans <code@jeremyevans.net>
151
+ kuwata-lab.com
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 The Ruby I18n team
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,127 @@
1
+ # Ruby I18n
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/i18n.svg)](https://badge.fury.io/rb/i18n)
4
+ [![Build Status](https://github.com/ruby-i18n/i18n/workflows/Ruby/badge.svg)](https://github.com/ruby-i18n/i18n/actions?query=workflow%3ARuby)
5
+
6
+ Ruby internationalization and localization (i18n) solution.
7
+
8
+ Currently maintained by @radar.
9
+
10
+ ## Usage
11
+
12
+ ### Rails
13
+
14
+ You will most commonly use this library within a Rails app.
15
+
16
+ We support Rails versions from 6.0 and up.
17
+
18
+ [See the Rails Guide](https://guides.rubyonrails.org/i18n.html) for an example of its usage.
19
+
20
+ ### Ruby (without Rails)
21
+
22
+ We support Ruby versions from 3.0 and up.
23
+
24
+ If you want to use this library without Rails, you can simply add `i18n` to your `Gemfile`:
25
+
26
+ ```ruby
27
+ gem 'i18n'
28
+ ```
29
+
30
+ Then configure I18n with some translations, and a default locale:
31
+
32
+ ```ruby
33
+ I18n.load_path += Dir[File.expand_path("config/locales") + "/*.yml"]
34
+ I18n.default_locale = :en # (note that `en` is already the default!)
35
+ ```
36
+
37
+ A simple translation file in your project might live at `config/locales/en.yml` and look like:
38
+
39
+ ```yml
40
+ en:
41
+ test: "This is a test"
42
+ ```
43
+
44
+ You can then access this translation by doing:
45
+
46
+ ```ruby
47
+ I18n.t(:test)
48
+ ```
49
+
50
+ You can switch locales in your project by setting `I18n.locale` to a different value:
51
+
52
+ ```ruby
53
+ I18n.locale = :de
54
+ I18n.t(:test) # => "Dies ist ein Test"
55
+ ```
56
+
57
+ ## Features
58
+
59
+ * Translation and localization
60
+ * Interpolation of values to translations
61
+ * Pluralization (CLDR compatible)
62
+ * Customizable transliteration to ASCII
63
+ * Flexible defaults
64
+ * Bulk lookup
65
+ * Lambdas as translation data
66
+ * Custom key/scope separator
67
+ * Custom exception handlers
68
+ * Extensible architecture with a swappable backend
69
+
70
+ ## Pluggable Features
71
+
72
+ * Cache
73
+ * Pluralization: lambda pluralizers stored as translation data
74
+ * Locale fallbacks, RFC4647 compliant (optionally: RFC4646 locale validation)
75
+ * [Gettext support](https://github.com/ruby-i18n/i18n/wiki/Gettext)
76
+ * Translation metadata
77
+
78
+ ## Alternative Backend
79
+
80
+ * Chain
81
+ * ActiveRecord (optionally: ActiveRecord::Missing and ActiveRecord::StoreProcs)
82
+ * KeyValue (uses active_support/json and cannot store procs)
83
+
84
+ For more information and lots of resources see [the 'Resources' page on the wiki](https://github.com/ruby-i18n/i18n/wiki/Resources).
85
+
86
+ ## Tests
87
+
88
+ You can run tests both with
89
+
90
+ * `rake test` or just `rake`
91
+ * run any test file directly, e.g. `ruby -Ilib:test test/api/simple_test.rb`
92
+
93
+ You can run all tests against all Gemfiles with
94
+
95
+ * `ruby test/run_all.rb`
96
+
97
+ The structure of the test suite is a bit unusual as it uses modules to reuse
98
+ particular tests in different test cases.
99
+
100
+ The reason for this is that we need to enforce the I18n API across various
101
+ combinations of extensions. E.g. the Simple backend alone needs to support
102
+ the same API as any combination of feature and/or optimization modules included
103
+ to the Simple backend. We test this by reusing the same API definition (implemented
104
+ as test methods) in test cases with different setups.
105
+
106
+ You can find the test cases that enforce the API in test/api. And you can find
107
+ the API definition test methods in test/api/tests.
108
+
109
+ All other test cases (e.g. as defined in test/backend, test/core_ext) etc.
110
+ follow the usual test setup and should be easy to grok.
111
+
112
+ ## More Documentation
113
+
114
+ Additional documentation can be found here: https://github.com/ruby-i18n/i18n/wiki
115
+
116
+ ## Contributors
117
+
118
+ * @radar
119
+ * @carlosantoniodasilva
120
+ * @josevalim
121
+ * @knapo
122
+ * @tigrish
123
+ * [and many more](https://github.com/ruby-i18n/i18n/graphs/contributors)
124
+
125
+ ## License
126
+
127
+ MIT License. See the included MIT-LICENSE file.
@@ -0,0 +1,104 @@
1
+ # Logger
2
+
3
+ Logger is a simple but powerful logging utility to output messages in your Ruby program.
4
+
5
+ Logger has the following features:
6
+
7
+ * Print messages to different levels such as `info` and `error`
8
+ * Auto-rolling of log files
9
+ * Setting the format of log messages
10
+ * Specifying a program name in conjunction with the message
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'logger'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install logger
27
+
28
+ ## Usage
29
+
30
+ ### Simple Example
31
+
32
+ ```ruby
33
+ require 'logger'
34
+
35
+ # Create a Logger that prints to STDOUT
36
+ log = Logger.new(STDOUT)
37
+ log.debug("Created Logger")
38
+
39
+ log.info("Program finished")
40
+
41
+ # Create a Logger that prints to STDERR
42
+ error_log = Logger.new(STDERR)
43
+ error_log = error_log.error("fatal error")
44
+ ```
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run the following to install dependencies.
49
+
50
+ ```
51
+ $ bin/setup
52
+ ```
53
+
54
+ Then, run the tests as:
55
+
56
+ ```
57
+ $ rake test
58
+ ```
59
+
60
+ To install this gem onto your local machine, run
61
+
62
+ ```
63
+ $ rake install
64
+ ```
65
+
66
+ To release a new version, update the version number in `lib/logger/version.rb`, and then run
67
+
68
+ ```
69
+ $ rake release
70
+ ```
71
+
72
+ which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
73
+
74
+ ## Advanced Development
75
+
76
+ ### Run tests of a specific file
77
+
78
+ ```
79
+ $ ruby test/logger/test_logger.rb
80
+ ```
81
+
82
+ ### Run tests filtering test methods by a name
83
+
84
+ `--name` option is available as:
85
+
86
+ ```
87
+ $ ruby test/logger/test_logger.rb --name test_lshift
88
+ ```
89
+
90
+ ### Publish documents to GitHub Pages
91
+
92
+ ```
93
+ $ rake gh-pages
94
+ ```
95
+
96
+ Then, git commit and push the generated HTMLs onto `gh-pages` branch.
97
+
98
+ ## Contributing
99
+
100
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/logger.
101
+
102
+ ## License
103
+
104
+ The gem is available as open source under the terms of the [BSD-2-Clause](BSDL).