acts-as-messageable 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/test.yml +152 -0
  4. data/.rubocop.yml +14 -1
  5. data/.rubocop_todo.yml +49 -7
  6. data/.ruby-version +1 -0
  7. data/Appraisals +11 -0
  8. data/Dockerfile +2 -1
  9. data/Gemfile +19 -13
  10. data/Gemfile.lock +186 -97
  11. data/README.md +2 -3
  12. data/Rakefile +6 -1
  13. data/VERSION +1 -1
  14. data/acts-as-messageable.gemspec +193 -40
  15. data/bin/tapioca +29 -0
  16. data/docker-compose.yml +82 -71
  17. data/gemfiles/rails_3.2.gemfile +14 -9
  18. data/gemfiles/rails_4.2.gemfile +14 -9
  19. data/gemfiles/rails_5.2.gemfile +14 -9
  20. data/gemfiles/rails_6.0.gemfile +14 -9
  21. data/gemfiles/rails_7.0.gemfile +29 -0
  22. data/gemfiles/rails_master.gemfile +15 -9
  23. data/lib/acts-as-messageable.rb +1 -0
  24. data/lib/acts_as_messageable/message.rb +62 -5
  25. data/lib/acts_as_messageable/model.rb +71 -20
  26. data/lib/acts_as_messageable/rails3.rb +27 -2
  27. data/lib/acts_as_messageable/rails4.rb +31 -4
  28. data/lib/acts_as_messageable/rails6.rb +34 -2
  29. data/lib/acts_as_messageable/railtie.rb +1 -0
  30. data/lib/acts_as_messageable/relation.rb +18 -2
  31. data/lib/acts_as_messageable/scopes.rb +11 -0
  32. data/lib/acts_as_messageable.rb +18 -0
  33. data/lib/generators/acts_as_messageable/migration/migration_generator.rb +4 -0
  34. data/lib/generators/acts_as_messageable/migration/templates/migration.rb +1 -0
  35. data/lib/generators/acts_as_messageable/migration/templates/migration_indexes.rb +1 -0
  36. data/lib/generators/acts_as_messageable/migration/templates/migration_opened_as_datetime.rb +1 -0
  37. data/lib/generators/acts_as_messageable/migration/templates/migration_permanent.rb +1 -0
  38. data/sorbet/config +4 -0
  39. data/sorbet/rbi/annotations/actionpack.rbi +428 -0
  40. data/sorbet/rbi/annotations/actionview.rbi +77 -0
  41. data/sorbet/rbi/annotations/activerecord.rbi +18 -0
  42. data/sorbet/rbi/annotations/activesupport.rbi +52 -0
  43. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  44. data/sorbet/rbi/annotations/railties.rbi +58 -0
  45. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  46. data/sorbet/rbi/dsl/abstract_controller/caching/fragments.rbi +23 -0
  47. data/sorbet/rbi/dsl/abstract_controller/caching.rbi +30 -0
  48. data/sorbet/rbi/dsl/abstract_controller/callbacks.rbi +23 -0
  49. data/sorbet/rbi/dsl/abstract_controller/helpers.rbi +23 -0
  50. data/sorbet/rbi/dsl/abstract_controller/rendering.rbi +9 -0
  51. data/sorbet/rbi/dsl/abstract_controller/url_for.rbi +23 -0
  52. data/sorbet/rbi/dsl/action_controller/caching.rbi +29 -0
  53. data/sorbet/rbi/dsl/action_controller/conditional_get.rbi +23 -0
  54. data/sorbet/rbi/dsl/action_controller/content_security_policy.rbi +31 -0
  55. data/sorbet/rbi/dsl/action_controller/data_streaming.rbi +9 -0
  56. data/sorbet/rbi/dsl/action_controller/etag_with_flash.rbi +24 -0
  57. data/sorbet/rbi/dsl/action_controller/etag_with_template_digest.rbi +30 -0
  58. data/sorbet/rbi/dsl/action_controller/flash.rbi +19 -0
  59. data/sorbet/rbi/dsl/action_controller/form_builder.rbi +19 -0
  60. data/sorbet/rbi/dsl/action_controller/helpers.rbi +36 -0
  61. data/sorbet/rbi/dsl/action_controller/params_wrapper.rbi +23 -0
  62. data/sorbet/rbi/dsl/action_controller/redirecting.rbi +24 -0
  63. data/sorbet/rbi/dsl/action_controller/renderers/all.rbi +24 -0
  64. data/sorbet/rbi/dsl/action_controller/renderers.rbi +23 -0
  65. data/sorbet/rbi/dsl/action_controller/request_forgery_protection.rbi +31 -0
  66. data/sorbet/rbi/dsl/action_controller/rescue.rbi +24 -0
  67. data/sorbet/rbi/dsl/action_controller/test_case/behavior.rbi +24 -0
  68. data/sorbet/rbi/dsl/action_controller/url_for.rbi +24 -0
  69. data/sorbet/rbi/dsl/action_dispatch/routing/url_for.rbi +23 -0
  70. data/sorbet/rbi/dsl/action_view/helpers/form_helper.rbi +10 -0
  71. data/sorbet/rbi/dsl/action_view/helpers/form_tag_helper.rbi +10 -0
  72. data/sorbet/rbi/dsl/action_view/helpers/text_helper.rbi +9 -0
  73. data/sorbet/rbi/dsl/action_view/helpers.rbi +10 -0
  74. data/sorbet/rbi/dsl/action_view/layouts.rbi +24 -0
  75. data/sorbet/rbi/dsl/action_view/rendering.rbi +9 -0
  76. data/sorbet/rbi/dsl/active_model/attribute_methods.rbi +27 -0
  77. data/sorbet/rbi/dsl/active_model/attributes.rbi +34 -0
  78. data/sorbet/rbi/dsl/active_model/dirty.rbi +28 -0
  79. data/sorbet/rbi/dsl/active_model/serializers/json.rbi +22 -0
  80. data/sorbet/rbi/dsl/active_model/validations/callbacks.rbi +22 -0
  81. data/sorbet/rbi/dsl/active_model/validations.rbi +27 -0
  82. data/sorbet/rbi/dsl/active_record/attribute_methods/dirty.rbi +38 -0
  83. data/sorbet/rbi/dsl/active_record/attribute_methods/time_zone_conversion.rbi +32 -0
  84. data/sorbet/rbi/dsl/active_record/attribute_methods.rbi +53 -0
  85. data/sorbet/rbi/dsl/active_record/attributes.rbi +19 -0
  86. data/sorbet/rbi/dsl/active_record/callbacks.rbi +22 -0
  87. data/sorbet/rbi/dsl/active_record/core.rbi +55 -0
  88. data/sorbet/rbi/dsl/active_record/encryption/encryptable_record.rbi +23 -0
  89. data/sorbet/rbi/dsl/active_record/inheritance.rbi +27 -0
  90. data/sorbet/rbi/dsl/active_record/integration.rbi +32 -0
  91. data/sorbet/rbi/dsl/active_record/locking/optimistic.rbi +22 -0
  92. data/sorbet/rbi/dsl/active_record/model_schema.rbi +52 -0
  93. data/sorbet/rbi/dsl/active_record/nested_attributes.rbi +22 -0
  94. data/sorbet/rbi/dsl/active_record/readonly_attributes.rbi +19 -0
  95. data/sorbet/rbi/dsl/active_record/reflection.rbi +32 -0
  96. data/sorbet/rbi/dsl/active_record/scoping/default.rbi +23 -0
  97. data/sorbet/rbi/dsl/active_record/scoping.rbi +23 -0
  98. data/sorbet/rbi/dsl/active_record/serialization.rbi +22 -0
  99. data/sorbet/rbi/dsl/active_record/signed_id.rbi +22 -0
  100. data/sorbet/rbi/dsl/active_record/test_fixtures.rbi +58 -0
  101. data/sorbet/rbi/dsl/active_record/timestamp.rbi +23 -0
  102. data/sorbet/rbi/dsl/active_record/validations.rbi +28 -0
  103. data/sorbet/rbi/dsl/active_support/actionable_error.rbi +23 -0
  104. data/sorbet/rbi/dsl/active_support/callbacks.rbi +22 -0
  105. data/sorbet/rbi/dsl/active_support/rescuable.rbi +23 -0
  106. data/sorbet/rbi/dsl/active_support/testing/file_fixtures.rbi +22 -0
  107. data/sorbet/rbi/gems/actionpack@7.0.4.3.rbi +19265 -0
  108. data/sorbet/rbi/gems/actionview@7.0.4.3.rbi +15482 -0
  109. data/sorbet/rbi/gems/activemodel@7.0.4.3.rbi +6025 -0
  110. data/sorbet/rbi/gems/activerecord@7.0.4.3.rbi +37852 -0
  111. data/sorbet/rbi/gems/activesupport@7.0.4.3.rbi +18788 -0
  112. data/sorbet/rbi/gems/addressable@2.4.0.rbi +8 -0
  113. data/sorbet/rbi/gems/appraisal@2.4.1.rbi +584 -0
  114. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  115. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  116. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
  117. data/sorbet/rbi/gems/commander@4.6.0.rbi +8 -0
  118. data/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi +11545 -0
  119. data/sorbet/rbi/gems/coveralls_reborn@0.27.0.rbi +8 -0
  120. data/sorbet/rbi/gems/crass@1.0.6.rbi +622 -0
  121. data/sorbet/rbi/gems/descendants_tracker@0.0.4.rbi +8 -0
  122. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  123. data/sorbet/rbi/gems/docile@1.4.0.rbi +8 -0
  124. data/sorbet/rbi/gems/erubi@1.12.0.rbi +146 -0
  125. data/sorbet/rbi/gems/faraday@0.9.2.rbi +964 -0
  126. data/sorbet/rbi/gems/git@1.11.0.rbi +2700 -0
  127. data/sorbet/rbi/gems/github_api@0.16.0.rbi +8 -0
  128. data/sorbet/rbi/gems/hashie@5.0.0.rbi +8 -0
  129. data/sorbet/rbi/gems/highline@2.0.3.rbi +8 -0
  130. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  131. data/sorbet/rbi/gems/jeweler@2.3.9.rbi +1591 -0
  132. data/sorbet/rbi/gems/json@2.6.3.rbi +1541 -0
  133. data/sorbet/rbi/gems/jwt@2.5.0.rbi +8 -0
  134. data/sorbet/rbi/gems/loofah@2.19.1.rbi +904 -0
  135. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  136. data/sorbet/rbi/gems/mime-types@2.99.3.rbi +8 -0
  137. data/sorbet/rbi/gems/minitest@5.18.0.rbi +1491 -0
  138. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +8 -0
  139. data/sorbet/rbi/gems/multi_xml@0.6.0.rbi +8 -0
  140. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +8 -0
  141. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  142. data/sorbet/rbi/gems/nokogiri@1.14.2.rbi +7244 -0
  143. data/sorbet/rbi/gems/oauth2@1.4.8.rbi +8 -0
  144. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  145. data/sorbet/rbi/gems/pg@1.4.6.rbi +2574 -0
  146. data/sorbet/rbi/gems/polyfill@1.9.0.rbi +8 -0
  147. data/sorbet/rbi/gems/pry@0.14.2.rbi +10081 -0
  148. data/sorbet/rbi/gems/psych@4.0.6.rbi +1819 -0
  149. data/sorbet/rbi/gems/racc@1.6.2.rbi +155 -0
  150. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +943 -0
  151. data/sorbet/rbi/gems/rack@2.2.6.4.rbi +5659 -0
  152. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +455 -0
  153. data/sorbet/rbi/gems/rails-html-sanitizer@1.5.0.rbi +685 -0
  154. data/sorbet/rbi/gems/railties@7.0.4.3.rbi +4553 -0
  155. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +8 -0
  156. data/sorbet/rbi/gems/rake@13.0.6.rbi +2959 -0
  157. data/sorbet/rbi/gems/rbi@0.0.16.rbi +3008 -0
  158. data/sorbet/rbi/gems/rbs@2.8.0.rbi +8 -0
  159. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +1078 -0
  160. data/sorbet/rbi/gems/rdoc@6.5.0.rbi +12441 -0
  161. data/sorbet/rbi/gems/regexp_parser@2.7.0.rbi +8 -0
  162. data/sorbet/rbi/gems/rexml@3.2.5.rbi +8 -0
  163. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10798 -0
  164. data/sorbet/rbi/gems/rspec-expectations@3.12.0.rbi +8090 -0
  165. data/sorbet/rbi/gems/rspec-mocks@3.12.0.rbi +5296 -0
  166. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1617 -0
  167. data/sorbet/rbi/gems/rspec@3.12.0.rbi +88 -0
  168. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +8 -0
  169. data/sorbet/rbi/gems/safe_type@1.1.1.rbi +8 -0
  170. data/sorbet/rbi/gems/semver2@3.4.2.rbi +8 -0
  171. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +8 -0
  172. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +8 -0
  173. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +8 -0
  174. data/sorbet/rbi/gems/sorbet-coerce@0.7.0.rbi +8 -0
  175. data/sorbet/rbi/gems/stringio@3.0.2.rbi +8 -0
  176. data/sorbet/rbi/gems/sync@0.5.0.rbi +8 -0
  177. data/sorbet/rbi/gems/term-ansicolor@1.7.1.rbi +8 -0
  178. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  179. data/sorbet/rbi/gems/thread_safe@0.3.6.rbi +8 -0
  180. data/sorbet/rbi/gems/timecop@0.9.6.rbi +361 -0
  181. data/sorbet/rbi/gems/tins@1.32.1.rbi +8 -0
  182. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5917 -0
  183. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +8 -0
  184. data/sorbet/rbi/gems/unparser@0.6.7.rbi +4515 -0
  185. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2553 -0
  186. data/sorbet/rbi/gems/yard@0.9.28.rbi +17954 -0
  187. data/sorbet/rbi/gems/zeitwerk@2.6.7.rbi +966 -0
  188. data/sorbet/rbi/models/acts-as-messageable/message.rbi +668 -0
  189. data/sorbet/rbi/models/acts-as-messageable/user.rbi +343 -0
  190. data/sorbet/rbi/rails-rbi/active_record_base.rbi +119 -0
  191. data/sorbet/rbi/rails-rbi/active_record_relation.rbi +180 -0
  192. data/sorbet/rbi/shims/activerecord.rbi +4 -0
  193. data/sorbet/rbi/shims/model.rbi +9 -0
  194. data/sorbet/tapioca/config.yml +10 -0
  195. data/sorbet/tapioca/pre_require.rb +5 -0
  196. data/sorbet/tapioca/require.rb +10 -0
  197. data/spec/acts_as_messageable_spec.rb +7 -4
  198. data/spec/custom_class_spec.rb +1 -0
  199. data/spec/custom_required_spec.rb +8 -4
  200. data/spec/group_messages_spec.rb +1 -0
  201. data/spec/migrations_spec.rb +2 -1
  202. data/spec/spec_helper.rb +19 -9
  203. data/spec/support/admin.rb +3 -0
  204. data/spec/support/custom_message.rb +3 -0
  205. data/spec/support/custom_message_uuid.rb +1 -0
  206. data/spec/support/custom_search_user.rb +3 -0
  207. data/spec/support/men.rb +1 -0
  208. data/spec/support/send_message.rb +8 -1
  209. data/spec/support/table_schema.rb +7 -6
  210. data/spec/support/user.rb +3 -0
  211. data/spec/support/uuid_user.rb +3 -0
  212. data/tasks/types.rake +46 -0
  213. metadata +261 -11
  214. data/.travis.yml +0 -55
@@ -0,0 +1,904 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `loofah` gem.
5
+ # Please instead update this file by running `bin/tapioca gem loofah`.
6
+
7
+ # == Strings and IO Objects as Input
8
+ #
9
+ # Loofah.document and Loofah.fragment accept any IO object in addition
10
+ # to accepting a string. That IO object could be a file, or a socket,
11
+ # or a StringIO, or anything that responds to +read+ and
12
+ # +close+. Which makes it particularly easy to sanitize mass
13
+ # quantities of docs.
14
+ #
15
+ # source://loofah//lib/loofah/version.rb#2
16
+ module Loofah
17
+ class << self
18
+ # Shortcut for Loofah::HTML::Document.parse
19
+ # This method accepts the same parameters as Nokogiri::HTML::Document.parse
20
+ #
21
+ # source://loofah//lib/loofah.rb#35
22
+ def document(*args, &block); end
23
+
24
+ # Shortcut for Loofah::HTML::DocumentFragment.parse
25
+ # This method accepts the same parameters as Nokogiri::HTML::DocumentFragment.parse
26
+ #
27
+ # source://loofah//lib/loofah.rb#41
28
+ def fragment(*args, &block); end
29
+
30
+ # A helper to remove extraneous whitespace from text-ified HTML
31
+ #
32
+ # source://loofah//lib/loofah.rb#78
33
+ def remove_extraneous_whitespace(string); end
34
+
35
+ # Shortcut for Loofah.document(string_or_io).scrub!(method)
36
+ #
37
+ # source://loofah//lib/loofah.rb#51
38
+ def scrub_document(string_or_io, method); end
39
+
40
+ # Shortcut for Loofah.fragment(string_or_io).scrub!(method)
41
+ #
42
+ # source://loofah//lib/loofah.rb#46
43
+ def scrub_fragment(string_or_io, method); end
44
+
45
+ # Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
46
+ #
47
+ # source://loofah//lib/loofah.rb#73
48
+ def scrub_xml_document(string_or_io, method); end
49
+
50
+ # Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
51
+ #
52
+ # source://loofah//lib/loofah.rb#68
53
+ def scrub_xml_fragment(string_or_io, method); end
54
+
55
+ # Shortcut for Loofah::XML::Document.parse
56
+ # This method accepts the same parameters as Nokogiri::XML::Document.parse
57
+ #
58
+ # source://loofah//lib/loofah.rb#57
59
+ def xml_document(*args, &block); end
60
+
61
+ # Shortcut for Loofah::XML::DocumentFragment.parse
62
+ # This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse
63
+ #
64
+ # source://loofah//lib/loofah.rb#63
65
+ def xml_fragment(*args, &block); end
66
+
67
+ private
68
+
69
+ # remove comments that exist outside of the HTML element.
70
+ #
71
+ # these comments are allowed by the HTML spec:
72
+ #
73
+ # https://www.w3.org/TR/html401/struct/global.html#h-7.1
74
+ #
75
+ # but are not scrubbed by Loofah because these nodes don't meet
76
+ # the contract that scrubbers expect of a node (e.g., it can be
77
+ # replaced, sibling and children nodes can be created).
78
+ #
79
+ # source://loofah//lib/loofah.rb#93
80
+ def remove_comments_before_html_element(doc); end
81
+ end
82
+ end
83
+
84
+ # source://loofah//lib/loofah/instance_methods.rb#126
85
+ module Loofah::DocumentDecorator
86
+ # source://loofah//lib/loofah/instance_methods.rb#127
87
+ def initialize(*args, &block); end
88
+ end
89
+
90
+ # source://loofah//lib/loofah/elements.rb#5
91
+ module Loofah::Elements; end
92
+
93
+ # source://loofah//lib/loofah/elements.rb#91
94
+ Loofah::Elements::BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
95
+
96
+ # Elements that aren't block but should generate a newline in #to_text
97
+ #
98
+ # source://loofah//lib/loofah/elements.rb#88
99
+ Loofah::Elements::INLINE_LINE_BREAK = T.let(T.unsafe(nil), Set)
100
+
101
+ # source://loofah//lib/loofah/elements.rb#92
102
+ Loofah::Elements::LINEBREAKERS = T.let(T.unsafe(nil), Set)
103
+
104
+ # The following elements may also be considered block-level
105
+ # elements since they may contain block-level elements
106
+ #
107
+ # source://loofah//lib/loofah/elements.rb#75
108
+ Loofah::Elements::LOOSE_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
109
+
110
+ # source://loofah//lib/loofah/elements.rb#90
111
+ Loofah::Elements::STRICT_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
112
+
113
+ # source://loofah//lib/loofah/elements.rb#6
114
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML4 = T.let(T.unsafe(nil), Set)
115
+
116
+ # https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
117
+ #
118
+ # source://loofah//lib/loofah/elements.rb#34
119
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML5 = T.let(T.unsafe(nil), Set)
120
+
121
+ # source://loofah//lib/loofah/html/document.rb#3
122
+ module Loofah::HTML; end
123
+
124
+ # source://loofah//lib/loofah/html5/safelist.rb#5
125
+ module Loofah::HTML5; end
126
+
127
+ # source://loofah//lib/loofah/html5/safelist.rb#48
128
+ module Loofah::HTML5::SafeList; end
129
+
130
+ # source://loofah//lib/loofah/html5/safelist.rb#226
131
+ Loofah::HTML5::SafeList::ACCEPTABLE_ATTRIBUTES = T.let(T.unsafe(nil), Set)
132
+
133
+ # https://www.w3.org/TR/css-color-3/#html4
134
+ #
135
+ # source://loofah//lib/loofah/html5/safelist.rb#724
136
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_COLORS = T.let(T.unsafe(nil), Set)
137
+
138
+ # https://www.w3.org/TR/css-color-3/#svg-color
139
+ #
140
+ # source://loofah//lib/loofah/html5/safelist.rb#744
141
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_EXTENDED_COLORS = T.let(T.unsafe(nil), Set)
142
+
143
+ # see https://www.quackit.com/css/functions/
144
+ # omit `url` and `image` from that list
145
+ #
146
+ # source://loofah//lib/loofah/html5/safelist.rb#896
147
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
148
+
149
+ # source://loofah//lib/loofah/html5/safelist.rb#685
150
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
151
+
152
+ # source://loofah//lib/loofah/html5/safelist.rb#615
153
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
154
+
155
+ # source://loofah//lib/loofah/html5/safelist.rb#49
156
+ Loofah::HTML5::SafeList::ACCEPTABLE_ELEMENTS = T.let(T.unsafe(nil), Set)
157
+
158
+ # source://loofah//lib/loofah/html5/safelist.rb#969
159
+ Loofah::HTML5::SafeList::ACCEPTABLE_PROTOCOLS = T.let(T.unsafe(nil), Set)
160
+
161
+ # source://loofah//lib/loofah/html5/safelist.rb#956
162
+ Loofah::HTML5::SafeList::ACCEPTABLE_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
163
+
164
+ # source://loofah//lib/loofah/html5/safelist.rb#998
165
+ Loofah::HTML5::SafeList::ACCEPTABLE_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
166
+
167
+ # source://loofah//lib/loofah/html5/safelist.rb#1008
168
+ Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES = T.let(T.unsafe(nil), Set)
169
+
170
+ # source://loofah//lib/loofah/html5/safelist.rb#1011
171
+ Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
172
+
173
+ # source://loofah//lib/loofah/html5/safelist.rb#1010
174
+ Loofah::HTML5::SafeList::ALLOWED_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
175
+
176
+ # source://loofah//lib/loofah/html5/safelist.rb#1009
177
+ Loofah::HTML5::SafeList::ALLOWED_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
178
+
179
+ # subclasses may define their own versions of these constants
180
+ #
181
+ # source://loofah//lib/loofah/html5/safelist.rb#1007
182
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS = T.let(T.unsafe(nil), Set)
183
+
184
+ # source://loofah//lib/loofah/html5/safelist.rb#1032
185
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
186
+
187
+ # source://loofah//lib/loofah/html5/safelist.rb#1013
188
+ Loofah::HTML5::SafeList::ALLOWED_PROTOCOLS = T.let(T.unsafe(nil), Set)
189
+
190
+ # source://loofah//lib/loofah/html5/safelist.rb#1012
191
+ Loofah::HTML5::SafeList::ALLOWED_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
192
+
193
+ # source://loofah//lib/loofah/html5/safelist.rb#1014
194
+ Loofah::HTML5::SafeList::ALLOWED_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
195
+
196
+ # source://loofah//lib/loofah/html5/safelist.rb#515
197
+ Loofah::HTML5::SafeList::ARIA_ATTRIBUTES = T.let(T.unsafe(nil), Set)
198
+
199
+ # source://loofah//lib/loofah/html5/safelist.rb#571
200
+ Loofah::HTML5::SafeList::ATTR_VAL_IS_URI = T.let(T.unsafe(nil), Set)
201
+
202
+ # source://loofah//lib/loofah/html5/safelist.rb#309
203
+ Loofah::HTML5::SafeList::MATHML_ATTRIBUTES = T.let(T.unsafe(nil), Set)
204
+
205
+ # source://loofah//lib/loofah/html5/safelist.rb#146
206
+ Loofah::HTML5::SafeList::MATHML_ELEMENTS = T.let(T.unsafe(nil), Set)
207
+
208
+ # source://loofah//lib/loofah/html5/safelist.rb#967
209
+ Loofah::HTML5::SafeList::PROTOCOL_SEPARATOR = T.let(T.unsafe(nil), Regexp)
210
+
211
+ # source://loofah//lib/loofah/html5/safelist.rb#949
212
+ Loofah::HTML5::SafeList::SHORTHAND_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
213
+
214
+ # source://loofah//lib/loofah/html5/safelist.rb#597
215
+ Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF = T.let(T.unsafe(nil), Set)
216
+
217
+ # source://loofah//lib/loofah/html5/safelist.rb#361
218
+ Loofah::HTML5::SafeList::SVG_ATTRIBUTES = T.let(T.unsafe(nil), Set)
219
+
220
+ # source://loofah//lib/loofah/html5/safelist.rb#583
221
+ Loofah::HTML5::SafeList::SVG_ATTR_VAL_ALLOWS_REF = T.let(T.unsafe(nil), Set)
222
+
223
+ # source://loofah//lib/loofah/html5/safelist.rb#182
224
+ Loofah::HTML5::SafeList::SVG_ELEMENTS = T.let(T.unsafe(nil), Set)
225
+
226
+ # additional tags we should consider safe since we have libxml2 fixing up our documents.
227
+ #
228
+ # source://loofah//lib/loofah/html5/safelist.rb#1027
229
+ Loofah::HTML5::SafeList::TAGS_SAFE_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
230
+
231
+ # TODO: remove VOID_ELEMENTS in a future major release
232
+ # and put it in the tests (it is used only for testing, not for functional behavior)
233
+ #
234
+ # source://loofah//lib/loofah/html5/safelist.rb#1018
235
+ Loofah::HTML5::SafeList::VOID_ELEMENTS = T.let(T.unsafe(nil), Set)
236
+
237
+ # source://loofah//lib/loofah/html5/scrub.rb#7
238
+ module Loofah::HTML5::Scrub
239
+ class << self
240
+ # @return [Boolean]
241
+ #
242
+ # source://loofah//lib/loofah/html5/scrub.rb#16
243
+ def allowed_element?(element_name); end
244
+
245
+ # source://loofah//lib/loofah/html5/scrub.rb#191
246
+ def cdata_escape(node); end
247
+
248
+ # @return [Boolean]
249
+ #
250
+ # source://loofah//lib/loofah/html5/scrub.rb#186
251
+ def cdata_needs_escaping?(node); end
252
+
253
+ # source://loofah//lib/loofah/html5/scrub.rb#206
254
+ def escape_tags(string); end
255
+
256
+ # libxml2 >= 2.9.2 fails to escape comments within some attributes.
257
+ #
258
+ # see comments about CVE-2018-8048 within the tests for more information
259
+ #
260
+ # source://loofah//lib/loofah/html5/scrub.rb#165
261
+ def force_correct_attribute_escaping!(node); end
262
+
263
+ # source://loofah//lib/loofah/html5/scrub.rb#119
264
+ def scrub_attribute_that_allows_local_ref(attr_node); end
265
+
266
+ # alternative implementation of the html5lib attribute scrubbing algorithm
267
+ #
268
+ # source://loofah//lib/loofah/html5/scrub.rb#21
269
+ def scrub_attributes(node); end
270
+
271
+ # source://loofah//lib/loofah/html5/scrub.rb#68
272
+ def scrub_css(style); end
273
+
274
+ # source://loofah//lib/loofah/html5/scrub.rb#63
275
+ def scrub_css_attribute(node); end
276
+
277
+ # source://loofah//lib/loofah/html5/scrub.rb#142
278
+ def scrub_uri_attribute(attr_node); end
279
+ end
280
+ end
281
+
282
+ # source://loofah//lib/loofah/html5/scrub.rb#8
283
+ Loofah::HTML5::Scrub::CONTROL_CHARACTERS = T.let(T.unsafe(nil), Regexp)
284
+
285
+ # source://loofah//lib/loofah/html5/scrub.rb#10
286
+ Loofah::HTML5::Scrub::CRASS_SEMICOLON = T.let(T.unsafe(nil), Hash)
287
+
288
+ # source://loofah//lib/loofah/html5/scrub.rb#11
289
+ Loofah::HTML5::Scrub::CSS_IMPORTANT = T.let(T.unsafe(nil), String)
290
+
291
+ # source://loofah//lib/loofah/html5/scrub.rb#9
292
+ Loofah::HTML5::Scrub::CSS_KEYWORDISH = T.let(T.unsafe(nil), Regexp)
293
+
294
+ # source://loofah//lib/loofah/html5/scrub.rb#12
295
+ Loofah::HTML5::Scrub::CSS_PROPERTY_STRING_WITHOUT_EMBEDDED_QUOTES = T.let(T.unsafe(nil), Regexp)
296
+
297
+ # source://loofah//lib/loofah/html5/scrub.rb#13
298
+ Loofah::HTML5::Scrub::DATA_ATTRIBUTE_NAME = T.let(T.unsafe(nil), Regexp)
299
+
300
+ # source://loofah//lib/loofah/html5/safelist.rb#1035
301
+ Loofah::HTML5::WhiteList = Loofah::HTML5::SafeList
302
+
303
+ # Subclass of Nokogiri::HTML::Document.
304
+ #
305
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
306
+ #
307
+ # source://loofah//lib/loofah/html/document.rb#9
308
+ class Loofah::HTML::Document < ::Nokogiri::HTML4::Document
309
+ include ::Loofah::ScrubBehavior::Node
310
+ include ::Loofah::DocumentDecorator
311
+ include ::Loofah::TextBehavior
312
+
313
+ # source://loofah//lib/loofah/html/document.rb#14
314
+ def serialize_root; end
315
+ end
316
+
317
+ # Subclass of Nokogiri::HTML::DocumentFragment.
318
+ #
319
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
320
+ #
321
+ # source://loofah//lib/loofah/html/document_fragment.rb#9
322
+ class Loofah::HTML::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
323
+ include ::Loofah::TextBehavior
324
+
325
+ # Returns the HTML markup contained by the fragment
326
+ #
327
+ # source://loofah//lib/loofah/html/document_fragment.rb#31
328
+ def serialize; end
329
+
330
+ # source://loofah//lib/loofah/html/document_fragment.rb#37
331
+ def serialize_root; end
332
+
333
+ # Returns the HTML markup contained by the fragment
334
+ #
335
+ # source://loofah//lib/loofah/html/document_fragment.rb#31
336
+ def to_s; end
337
+
338
+ class << self
339
+ # Overridden Nokogiri::HTML::DocumentFragment
340
+ # constructor. Applications should use Loofah.fragment to
341
+ # parse a fragment.
342
+ #
343
+ # source://loofah//lib/loofah/html/document_fragment.rb#18
344
+ def parse(tags, encoding = T.unsafe(nil)); end
345
+ end
346
+ end
347
+
348
+ # constants related to working around unhelpful libxml2 behavior
349
+ #
350
+ # ಠ_ಠ
351
+ #
352
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#11
353
+ module Loofah::LibxmlWorkarounds; end
354
+
355
+ # these attributes and qualifying parent tags are determined by the code at:
356
+ #
357
+ # https://git.gnome.org/browse/libxml2/tree/HTMLtree.c?h=v2.9.2#n714
358
+ #
359
+ # see comments about CVE-2018-8048 within the tests for more information
360
+ #
361
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#19
362
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES = T.let(T.unsafe(nil), Set)
363
+
364
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#25
365
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = T.let(T.unsafe(nil), Hash)
366
+
367
+ # source://loofah//lib/loofah/metahelpers.rb#3
368
+ module Loofah::MetaHelpers
369
+ class << self
370
+ # source://loofah//lib/loofah/metahelpers.rb#4
371
+ def add_downcased_set_members_to_all_set_constants(mojule); end
372
+ end
373
+ end
374
+
375
+ # Mixes +scrub!+ into Document, DocumentFragment, Node and NodeSet.
376
+ #
377
+ # Traverse the document or fragment, invoking the +scrubber+ on
378
+ # each node.
379
+ #
380
+ # +scrubber+ must either be one of the symbols representing the
381
+ # built-in scrubbers (see Scrubbers), or a Scrubber instance.
382
+ #
383
+ # span2div = Loofah::Scrubber.new do |node|
384
+ # node.name = "div" if node.name == "span"
385
+ # end
386
+ # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
387
+ # # => "<div>foo</div><p>bar</p>"
388
+ #
389
+ # or
390
+ #
391
+ # unsafe_html = "ohai! <div>div is safe</div> <script>but script is not</script>"
392
+ # Loofah.fragment(unsafe_html).scrub!(:strip).to_s
393
+ # # => "ohai! <div>div is safe</div> "
394
+ #
395
+ # Note that this method is called implicitly from
396
+ # Loofah.scrub_fragment and Loofah.scrub_document.
397
+ #
398
+ # Please see Scrubber for more information on implementation and traversal, and
399
+ # README.rdoc for more example usage.
400
+ #
401
+ # source://loofah//lib/loofah/instance_methods.rb#30
402
+ module Loofah::ScrubBehavior
403
+ class << self
404
+ # source://loofah//lib/loofah/instance_methods.rb#60
405
+ def resolve_scrubber(scrubber); end
406
+ end
407
+ end
408
+
409
+ # source://loofah//lib/loofah/instance_methods.rb#31
410
+ module Loofah::ScrubBehavior::Node
411
+ # source://loofah//lib/loofah/instance_methods.rb#32
412
+ def scrub!(scrubber); end
413
+ end
414
+
415
+ # source://loofah//lib/loofah/instance_methods.rb#53
416
+ module Loofah::ScrubBehavior::NodeSet
417
+ # source://loofah//lib/loofah/instance_methods.rb#54
418
+ def scrub!(scrubber); end
419
+ end
420
+
421
+ # A Scrubber wraps up a block (or method) that is run on an HTML node (element):
422
+ #
423
+ # # change all <span> tags to <div> tags
424
+ # span2div = Loofah::Scrubber.new do |node|
425
+ # node.name = "div" if node.name == "span"
426
+ # end
427
+ #
428
+ # Alternatively, this scrubber could have been implemented as:
429
+ #
430
+ # class Span2Div < Loofah::Scrubber
431
+ # def scrub(node)
432
+ # node.name = "div" if node.name == "span"
433
+ # end
434
+ # end
435
+ # span2div = Span2Div.new
436
+ #
437
+ # This can then be run on a document:
438
+ #
439
+ # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
440
+ # # => "<div>foo</div><p>bar</p>"
441
+ #
442
+ # Scrubbers can be run on a document in either a top-down traversal (the
443
+ # default) or bottom-up. Top-down scrubbers can optionally return
444
+ # Scrubber::STOP to terminate the traversal of a subtree.
445
+ #
446
+ # source://loofah//lib/loofah/scrubber.rb#34
447
+ class Loofah::Scrubber
448
+ # Options may include
449
+ # :direction => :top_down (the default)
450
+ # or
451
+ # :direction => :bottom_up
452
+ #
453
+ # For top_down traversals, if the block returns
454
+ # Loofah::Scrubber::STOP, then the traversal will be terminated
455
+ # for the current node's subtree.
456
+ #
457
+ # Alternatively, a Scrubber may inherit from Loofah::Scrubber,
458
+ # and implement +scrub+, which is slightly faster than using a
459
+ # block.
460
+ #
461
+ # @return [Scrubber] a new instance of Scrubber
462
+ #
463
+ # source://loofah//lib/loofah/scrubber.rb#65
464
+ def initialize(options = T.unsafe(nil), &block); end
465
+
466
+ # If the attribute is not set, add it
467
+ # If the attribute is set, don't overwrite the existing value
468
+ #
469
+ # source://loofah//lib/loofah/scrubber.rb#94
470
+ def append_attribute(node, attribute, value); end
471
+
472
+ # When a scrubber is initialized, the optional block is saved as
473
+ # :block. Note that, if no block is passed, then the +scrub+
474
+ # method is assumed to have been implemented.
475
+ #
476
+ # source://loofah//lib/loofah/scrubber.rb#49
477
+ def block; end
478
+
479
+ # When a scrubber is initialized, the :direction may be specified
480
+ # as :top_down (the default) or :bottom_up.
481
+ #
482
+ # source://loofah//lib/loofah/scrubber.rb#44
483
+ def direction; end
484
+
485
+ # When +new+ is not passed a block, the class may implement
486
+ # +scrub+, which will be called for each document node.
487
+ #
488
+ # @raise [ScrubberNotFound]
489
+ #
490
+ # source://loofah//lib/loofah/scrubber.rb#86
491
+ def scrub(node); end
492
+
493
+ # Calling +traverse+ will cause the document to be traversed by
494
+ # either the lambda passed to the initializer or the +scrub+
495
+ # method, in the direction specified at +new+ time.
496
+ #
497
+ # source://loofah//lib/loofah/scrubber.rb#78
498
+ def traverse(node); end
499
+
500
+ private
501
+
502
+ # source://loofah//lib/loofah/scrubber.rb#103
503
+ def html5lib_sanitize(node); end
504
+
505
+ # source://loofah//lib/loofah/scrubber.rb#129
506
+ def traverse_conditionally_bottom_up(node); end
507
+
508
+ # source://loofah//lib/loofah/scrubber.rb#120
509
+ def traverse_conditionally_top_down(node); end
510
+ end
511
+
512
+ # Top-down Scrubbers may return CONTINUE to indicate that the subtree should be traversed.
513
+ #
514
+ # source://loofah//lib/loofah/scrubber.rb#37
515
+ Loofah::Scrubber::CONTINUE = T.let(T.unsafe(nil), Object)
516
+
517
+ # Top-down Scrubbers may return STOP to indicate that the subtree should not be traversed.
518
+ #
519
+ # source://loofah//lib/loofah/scrubber.rb#40
520
+ Loofah::Scrubber::STOP = T.let(T.unsafe(nil), Object)
521
+
522
+ # A RuntimeError raised when Loofah could not find an appropriate scrubber.
523
+ #
524
+ # source://loofah//lib/loofah/scrubber.rb#6
525
+ class Loofah::ScrubberNotFound < ::RuntimeError; end
526
+
527
+ # Loofah provides some built-in scrubbers for sanitizing with
528
+ # HTML5lib's safelist and for accomplishing some common
529
+ # transformation tasks.
530
+ #
531
+ #
532
+ # === Loofah::Scrubbers::Strip / scrub!(:strip)
533
+ #
534
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
535
+ #
536
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
537
+ # Loofah.fragment(unsafe_html).scrub!(:strip)
538
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
539
+ #
540
+ #
541
+ # === Loofah::Scrubbers::Prune / scrub!(:prune)
542
+ #
543
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
544
+ #
545
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
546
+ # Loofah.fragment(unsafe_html).scrub!(:prune)
547
+ # => "ohai! <div>div is safe</div> "
548
+ #
549
+ #
550
+ # === Loofah::Scrubbers::Escape / scrub!(:escape)
551
+ #
552
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
553
+ #
554
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
555
+ # Loofah.fragment(unsafe_html).scrub!(:escape)
556
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
557
+ #
558
+ #
559
+ # === Loofah::Scrubbers::Whitewash / scrub!(:whitewash)
560
+ #
561
+ # +:whitewash+ removes all comments, styling and attributes in
562
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
563
+ # like to call this "whitewashing", since it's like putting a new
564
+ # layer of paint on top of the HTML input to make it look nice.
565
+ #
566
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
567
+ # Loofah.fragment(messy_markup).scrub!(:whitewash)
568
+ # => "ohai! <div>div with attributes</div>"
569
+ #
570
+ # One use case for this scrubber is to clean up HTML that was
571
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
572
+ # rich text editor. Microsoft's software is famous for injecting
573
+ # all kinds of cruft into its HTML output. Who needs that crap?
574
+ # Certainly not me.
575
+ #
576
+ #
577
+ # === Loofah::Scrubbers::NoFollow / scrub!(:nofollow)
578
+ #
579
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
580
+ #
581
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
582
+ # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
583
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
584
+ #
585
+ #
586
+ # === Loofah::Scrubbers::NoOpener / scrub!(:noopener)
587
+ #
588
+ # +:noopener+ adds a rel="noopener" attribute to all links
589
+ #
590
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
591
+ # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
592
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
593
+ #
594
+ #
595
+ # === Loofah::Scrubbers::Unprintable / scrub!(:unprintable)
596
+ #
597
+ # +:unprintable+ removes unprintable Unicode characters.
598
+ #
599
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
600
+ # Loofah.fragment(markup).scrub!(:unprintable)
601
+ # => "<p>Some text with an unprintable character at the end</p>"
602
+ #
603
+ # You may not be able to see the unprintable character in the above example, but there is a
604
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
605
+ # the content is ever parsed by JavaScript - more information here:
606
+ #
607
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
608
+ #
609
+ # source://loofah//lib/loofah/scrubbers.rb#86
610
+ module Loofah::Scrubbers
611
+ class << self
612
+ # Returns an array of symbols representing the built-in scrubbers
613
+ #
614
+ # source://loofah//lib/loofah/scrubbers.rb#295
615
+ def scrubber_symbols; end
616
+ end
617
+ end
618
+
619
+ # === scrub!(:escape)
620
+ #
621
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
622
+ #
623
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
624
+ # Loofah.fragment(unsafe_html).scrub!(:escape)
625
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
626
+ #
627
+ # source://loofah//lib/loofah/scrubbers.rb#139
628
+ class Loofah::Scrubbers::Escape < ::Loofah::Scrubber
629
+ # @return [Escape] a new instance of Escape
630
+ #
631
+ # source://loofah//lib/loofah/scrubbers.rb#140
632
+ def initialize; end
633
+
634
+ # source://loofah//lib/loofah/scrubbers.rb#144
635
+ def scrub(node); end
636
+ end
637
+
638
+ # A hash that maps a symbol (like +:prune+) to the appropriate Scrubber (Loofah::Scrubbers::Prune).
639
+ #
640
+ # source://loofah//lib/loofah/scrubbers.rb#281
641
+ Loofah::Scrubbers::MAP = T.let(T.unsafe(nil), Hash)
642
+
643
+ # This class probably isn't useful publicly, but is used for #to_text's current implemention
644
+ #
645
+ # source://loofah//lib/loofah/scrubbers.rb#233
646
+ class Loofah::Scrubbers::NewlineBlockElements < ::Loofah::Scrubber
647
+ # @return [NewlineBlockElements] a new instance of NewlineBlockElements
648
+ #
649
+ # source://loofah//lib/loofah/scrubbers.rb#234
650
+ def initialize; end
651
+
652
+ # source://loofah//lib/loofah/scrubbers.rb#238
653
+ def scrub(node); end
654
+ end
655
+
656
+ # === scrub!(:nofollow)
657
+ #
658
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
659
+ #
660
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
661
+ # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
662
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
663
+ #
664
+ # source://loofah//lib/loofah/scrubbers.rb#199
665
+ class Loofah::Scrubbers::NoFollow < ::Loofah::Scrubber
666
+ # @return [NoFollow] a new instance of NoFollow
667
+ #
668
+ # source://loofah//lib/loofah/scrubbers.rb#200
669
+ def initialize; end
670
+
671
+ # source://loofah//lib/loofah/scrubbers.rb#204
672
+ def scrub(node); end
673
+ end
674
+
675
+ # === scrub!(:noopener)
676
+ #
677
+ # +:noopener+ adds a rel="noopener" attribute to all links
678
+ #
679
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
680
+ # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
681
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
682
+ #
683
+ # source://loofah//lib/loofah/scrubbers.rb#220
684
+ class Loofah::Scrubbers::NoOpener < ::Loofah::Scrubber
685
+ # @return [NoOpener] a new instance of NoOpener
686
+ #
687
+ # source://loofah//lib/loofah/scrubbers.rb#221
688
+ def initialize; end
689
+
690
+ # source://loofah//lib/loofah/scrubbers.rb#225
691
+ def scrub(node); end
692
+ end
693
+
694
+ # === scrub!(:prune)
695
+ #
696
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
697
+ #
698
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
699
+ # Loofah.fragment(unsafe_html).scrub!(:prune)
700
+ # => "ohai! <div>div is safe</div> "
701
+ #
702
+ # source://loofah//lib/loofah/scrubbers.rb#118
703
+ class Loofah::Scrubbers::Prune < ::Loofah::Scrubber
704
+ # @return [Prune] a new instance of Prune
705
+ #
706
+ # source://loofah//lib/loofah/scrubbers.rb#119
707
+ def initialize; end
708
+
709
+ # source://loofah//lib/loofah/scrubbers.rb#123
710
+ def scrub(node); end
711
+ end
712
+
713
+ # === scrub!(:strip)
714
+ #
715
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
716
+ #
717
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
718
+ # Loofah.fragment(unsafe_html).scrub!(:strip)
719
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
720
+ #
721
+ # source://loofah//lib/loofah/scrubbers.rb#96
722
+ class Loofah::Scrubbers::Strip < ::Loofah::Scrubber
723
+ # @return [Strip] a new instance of Strip
724
+ #
725
+ # source://loofah//lib/loofah/scrubbers.rb#97
726
+ def initialize; end
727
+
728
+ # source://loofah//lib/loofah/scrubbers.rb#101
729
+ def scrub(node); end
730
+ end
731
+
732
+ # === scrub!(:unprintable)
733
+ #
734
+ # +:unprintable+ removes unprintable Unicode characters.
735
+ #
736
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
737
+ # Loofah.fragment(markup).scrub!(:unprintable)
738
+ # => "<p>Some text with an unprintable character at the end</p>"
739
+ #
740
+ # You may not be able to see the unprintable character in the above example, but there is a
741
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
742
+ # the content is ever parsed by JavaScript - more information here:
743
+ #
744
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
745
+ #
746
+ # source://loofah//lib/loofah/scrubbers.rb#265
747
+ class Loofah::Scrubbers::Unprintable < ::Loofah::Scrubber
748
+ # @return [Unprintable] a new instance of Unprintable
749
+ #
750
+ # source://loofah//lib/loofah/scrubbers.rb#266
751
+ def initialize; end
752
+
753
+ # source://loofah//lib/loofah/scrubbers.rb#270
754
+ def scrub(node); end
755
+ end
756
+
757
+ # === scrub!(:whitewash)
758
+ #
759
+ # +:whitewash+ removes all comments, styling and attributes in
760
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
761
+ # like to call this "whitewashing", since it's like putting a new
762
+ # layer of paint on top of the HTML input to make it look nice.
763
+ #
764
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
765
+ # Loofah.fragment(messy_markup).scrub!(:whitewash)
766
+ # => "ohai! <div>div with attributes</div>"
767
+ #
768
+ # One use case for this scrubber is to clean up HTML that was
769
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
770
+ # rich text editor. Microsoft's software is famous for injecting
771
+ # all kinds of cruft into its HTML output. Who needs that crap?
772
+ # Certainly not me.
773
+ #
774
+ # source://loofah//lib/loofah/scrubbers.rb#170
775
+ class Loofah::Scrubbers::Whitewash < ::Loofah::Scrubber
776
+ # @return [Whitewash] a new instance of Whitewash
777
+ #
778
+ # source://loofah//lib/loofah/scrubbers.rb#171
779
+ def initialize; end
780
+
781
+ # source://loofah//lib/loofah/scrubbers.rb#175
782
+ def scrub(node); end
783
+ end
784
+
785
+ # Overrides +text+ in HTML::Document and HTML::DocumentFragment,
786
+ # and mixes in +to_text+.
787
+ #
788
+ # source://loofah//lib/loofah/instance_methods.rb#73
789
+ module Loofah::TextBehavior
790
+ # Returns a plain-text version of the markup contained by the document,
791
+ # with HTML entities encoded.
792
+ #
793
+ # This method is significantly faster than #to_text, but isn't
794
+ # clever about whitespace around block elements.
795
+ #
796
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
797
+ # # => "TitleContent"
798
+ #
799
+ # By default, the returned text will have HTML entities
800
+ # escaped. If you want unescaped entities, and you understand
801
+ # that the result is unsafe to render in a browser, then you
802
+ # can pass an argument as shown:
803
+ #
804
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
805
+ # # ok for browser:
806
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
807
+ # # decidedly not ok for browser:
808
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
809
+ #
810
+ # source://loofah//lib/loofah/instance_methods.rb#95
811
+ def inner_text(options = T.unsafe(nil)); end
812
+
813
+ # Returns a plain-text version of the markup contained by the document,
814
+ # with HTML entities encoded.
815
+ #
816
+ # This method is significantly faster than #to_text, but isn't
817
+ # clever about whitespace around block elements.
818
+ #
819
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
820
+ # # => "TitleContent"
821
+ #
822
+ # By default, the returned text will have HTML entities
823
+ # escaped. If you want unescaped entities, and you understand
824
+ # that the result is unsafe to render in a browser, then you
825
+ # can pass an argument as shown:
826
+ #
827
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
828
+ # # ok for browser:
829
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
830
+ # # decidedly not ok for browser:
831
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
832
+ #
833
+ # source://loofah//lib/loofah/instance_methods.rb#95
834
+ def text(options = T.unsafe(nil)); end
835
+
836
+ # Returns a plain-text version of the markup contained by the document,
837
+ # with HTML entities encoded.
838
+ #
839
+ # This method is significantly faster than #to_text, but isn't
840
+ # clever about whitespace around block elements.
841
+ #
842
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
843
+ # # => "TitleContent"
844
+ #
845
+ # By default, the returned text will have HTML entities
846
+ # escaped. If you want unescaped entities, and you understand
847
+ # that the result is unsafe to render in a browser, then you
848
+ # can pass an argument as shown:
849
+ #
850
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
851
+ # # ok for browser:
852
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
853
+ # # decidedly not ok for browser:
854
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
855
+ #
856
+ # source://loofah//lib/loofah/instance_methods.rb#95
857
+ def to_str(options = T.unsafe(nil)); end
858
+
859
+ # Returns a plain-text version of the markup contained by the
860
+ # fragment, with HTML entities encoded.
861
+ #
862
+ # This method is slower than #text, but is clever about
863
+ # whitespace around block elements and line break elements.
864
+ #
865
+ # Loofah.document("<h1>Title</h1><div>Content<br>Next line</div>").to_text
866
+ # # => "\nTitle\n\nContent\nNext line\n"
867
+ #
868
+ # source://loofah//lib/loofah/instance_methods.rb#121
869
+ def to_text(options = T.unsafe(nil)); end
870
+ end
871
+
872
+ # The version of Loofah you are using
873
+ #
874
+ # source://loofah//lib/loofah/version.rb#4
875
+ Loofah::VERSION = T.let(T.unsafe(nil), String)
876
+
877
+ # source://loofah//lib/loofah/xml/document.rb#3
878
+ module Loofah::XML; end
879
+
880
+ # Subclass of Nokogiri::XML::Document.
881
+ #
882
+ # See Loofah::ScrubBehavior and Loofah::DocumentDecorator for additional methods.
883
+ #
884
+ # source://loofah//lib/loofah/xml/document.rb#9
885
+ class Loofah::XML::Document < ::Nokogiri::XML::Document
886
+ include ::Loofah::ScrubBehavior::Node
887
+ include ::Loofah::DocumentDecorator
888
+ end
889
+
890
+ # Subclass of Nokogiri::XML::DocumentFragment.
891
+ #
892
+ # See Loofah::ScrubBehavior for additional methods.
893
+ #
894
+ # source://loofah//lib/loofah/xml/document_fragment.rb#9
895
+ class Loofah::XML::DocumentFragment < ::Nokogiri::XML::DocumentFragment
896
+ class << self
897
+ # Overridden Nokogiri::XML::DocumentFragment
898
+ # constructor. Applications should use Loofah.fragment to
899
+ # parse a fragment.
900
+ #
901
+ # source://loofah//lib/loofah/xml/document_fragment.rb#16
902
+ def parse(tags); end
903
+ end
904
+ end