active_cached_resource 0.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +22 -0
  4. data/.standard.yml +2 -0
  5. data/CHANGELOG.md +5 -0
  6. data/README.md +45 -0
  7. data/Rakefile +21 -0
  8. data/example/consumer/.dockerignore +41 -0
  9. data/example/consumer/.gitattributes +9 -0
  10. data/example/consumer/.gitignore +36 -0
  11. data/example/consumer/.kamal/hooks/docker-setup.sample +3 -0
  12. data/example/consumer/.kamal/hooks/post-deploy.sample +14 -0
  13. data/example/consumer/.kamal/hooks/post-proxy-reboot.sample +3 -0
  14. data/example/consumer/.kamal/hooks/pre-build.sample +51 -0
  15. data/example/consumer/.kamal/hooks/pre-connect.sample +47 -0
  16. data/example/consumer/.kamal/hooks/pre-deploy.sample +109 -0
  17. data/example/consumer/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  18. data/example/consumer/.kamal/secrets +17 -0
  19. data/example/consumer/Dockerfile +65 -0
  20. data/example/consumer/Gemfile +17 -0
  21. data/example/consumer/Rakefile +6 -0
  22. data/example/consumer/app/controllers/application_controller.rb +2 -0
  23. data/example/consumer/app/controllers/concerns/.keep +0 -0
  24. data/example/consumer/app/jobs/application_job.rb +7 -0
  25. data/example/consumer/app/mailers/application_mailer.rb +4 -0
  26. data/example/consumer/app/models/application_record.rb +3 -0
  27. data/example/consumer/app/models/concerns/.keep +0 -0
  28. data/example/consumer/app/models/person.rb +9 -0
  29. data/example/consumer/app/views/layouts/mailer.html.erb +13 -0
  30. data/example/consumer/app/views/layouts/mailer.text.erb +1 -0
  31. data/example/consumer/bin/brakeman +7 -0
  32. data/example/consumer/bin/bundle +109 -0
  33. data/example/consumer/bin/dev +2 -0
  34. data/example/consumer/bin/docker-entrypoint +14 -0
  35. data/example/consumer/bin/jobs +6 -0
  36. data/example/consumer/bin/kamal +27 -0
  37. data/example/consumer/bin/rails +4 -0
  38. data/example/consumer/bin/rake +4 -0
  39. data/example/consumer/bin/rubocop +8 -0
  40. data/example/consumer/bin/setup +34 -0
  41. data/example/consumer/bin/thrust +5 -0
  42. data/example/consumer/config/application.rb +20 -0
  43. data/example/consumer/config/boot.rb +3 -0
  44. data/example/consumer/config/cache.yml +16 -0
  45. data/example/consumer/config/credentials.yml.enc +1 -0
  46. data/example/consumer/config/database.yml +14 -0
  47. data/example/consumer/config/deploy.yml +116 -0
  48. data/example/consumer/config/environment.rb +5 -0
  49. data/example/consumer/config/environments/development.rb +64 -0
  50. data/example/consumer/config/environments/production.rb +85 -0
  51. data/example/consumer/config/environments/test.rb +50 -0
  52. data/example/consumer/config/initializers/cors.rb +16 -0
  53. data/example/consumer/config/initializers/filter_parameter_logging.rb +8 -0
  54. data/example/consumer/config/initializers/inflections.rb +16 -0
  55. data/example/consumer/config/locales/en.yml +31 -0
  56. data/example/consumer/config/puma.rb +41 -0
  57. data/example/consumer/config/queue.yml +18 -0
  58. data/example/consumer/config/recurring.yml +10 -0
  59. data/example/consumer/config/routes.rb +10 -0
  60. data/example/consumer/config.ru +6 -0
  61. data/example/consumer/db/cache_schema.rb +14 -0
  62. data/example/consumer/db/queue_schema.rb +129 -0
  63. data/example/consumer/db/seeds.rb +0 -0
  64. data/example/consumer/lib/tasks/.keep +0 -0
  65. data/example/consumer/log/.keep +0 -0
  66. data/example/consumer/public/robots.txt +1 -0
  67. data/example/consumer/script/.keep +0 -0
  68. data/example/consumer/storage/.keep +0 -0
  69. data/example/consumer/tmp/.keep +0 -0
  70. data/example/consumer/tmp/cache/.keep +0 -0
  71. data/example/consumer/tmp/pids/.keep +0 -0
  72. data/example/consumer/tmp/storage/.keep +0 -0
  73. data/example/consumer/vendor/.keep +0 -0
  74. data/example/provider/.dockerignore +41 -0
  75. data/example/provider/.gitattributes +9 -0
  76. data/example/provider/.gitignore +32 -0
  77. data/example/provider/.kamal/hooks/docker-setup.sample +3 -0
  78. data/example/provider/.kamal/hooks/post-deploy.sample +14 -0
  79. data/example/provider/.kamal/hooks/post-proxy-reboot.sample +3 -0
  80. data/example/provider/.kamal/hooks/pre-build.sample +51 -0
  81. data/example/provider/.kamal/hooks/pre-connect.sample +47 -0
  82. data/example/provider/.kamal/hooks/pre-deploy.sample +109 -0
  83. data/example/provider/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  84. data/example/provider/.kamal/secrets +17 -0
  85. data/example/provider/Dockerfile +65 -0
  86. data/example/provider/Gemfile +14 -0
  87. data/example/provider/Rakefile +6 -0
  88. data/example/provider/app/controllers/application_controller.rb +2 -0
  89. data/example/provider/app/controllers/concerns/.keep +0 -0
  90. data/example/provider/app/controllers/people_controller.rb +68 -0
  91. data/example/provider/app/jobs/application_job.rb +7 -0
  92. data/example/provider/app/mailers/application_mailer.rb +4 -0
  93. data/example/provider/app/models/address.rb +3 -0
  94. data/example/provider/app/models/application_record.rb +3 -0
  95. data/example/provider/app/models/company.rb +3 -0
  96. data/example/provider/app/models/concerns/.keep +0 -0
  97. data/example/provider/app/models/person.rb +6 -0
  98. data/example/provider/app/views/layouts/mailer.html.erb +13 -0
  99. data/example/provider/app/views/layouts/mailer.text.erb +1 -0
  100. data/example/provider/bin/brakeman +7 -0
  101. data/example/provider/bin/bundle +109 -0
  102. data/example/provider/bin/dev +2 -0
  103. data/example/provider/bin/docker-entrypoint +14 -0
  104. data/example/provider/bin/jobs +6 -0
  105. data/example/provider/bin/kamal +27 -0
  106. data/example/provider/bin/rails +4 -0
  107. data/example/provider/bin/rake +4 -0
  108. data/example/provider/bin/rubocop +8 -0
  109. data/example/provider/bin/setup +34 -0
  110. data/example/provider/bin/thrust +5 -0
  111. data/example/provider/config/application.rb +44 -0
  112. data/example/provider/config/boot.rb +3 -0
  113. data/example/provider/config/cache.yml +16 -0
  114. data/example/provider/config/credentials.yml.enc +1 -0
  115. data/example/provider/config/database.yml +20 -0
  116. data/example/provider/config/deploy.yml +116 -0
  117. data/example/provider/config/environment.rb +5 -0
  118. data/example/provider/config/environments/development.rb +64 -0
  119. data/example/provider/config/environments/production.rb +85 -0
  120. data/example/provider/config/environments/test.rb +50 -0
  121. data/example/provider/config/initializers/cors.rb +16 -0
  122. data/example/provider/config/initializers/filter_parameter_logging.rb +8 -0
  123. data/example/provider/config/initializers/inflections.rb +16 -0
  124. data/example/provider/config/locales/en.yml +31 -0
  125. data/example/provider/config/puma.rb +41 -0
  126. data/example/provider/config/queue.yml +18 -0
  127. data/example/provider/config/recurring.yml +10 -0
  128. data/example/provider/config/routes.rb +4 -0
  129. data/example/provider/config.ru +6 -0
  130. data/example/provider/db/cache_schema.rb +14 -0
  131. data/example/provider/db/migrate/20241202183937_create_people.rb +11 -0
  132. data/example/provider/db/migrate/20241202183955_create_addresses.rb +13 -0
  133. data/example/provider/db/migrate/20241202184017_create_companies.rb +14 -0
  134. data/example/provider/db/queue_schema.rb +129 -0
  135. data/example/provider/db/schema.rb +47 -0
  136. data/example/provider/db/seeds.rb +18 -0
  137. data/example/provider/lib/tasks/.keep +0 -0
  138. data/example/provider/log/.keep +0 -0
  139. data/example/provider/public/robots.txt +1 -0
  140. data/example/provider/script/.keep +0 -0
  141. data/example/provider/storage/.keep +0 -0
  142. data/example/provider/tmp/.keep +0 -0
  143. data/example/provider/tmp/pids/.keep +0 -0
  144. data/example/provider/tmp/storage/.keep +0 -0
  145. data/example/provider/vendor/.keep +0 -0
  146. data/lib/active_cached_resource/caching.rb +176 -0
  147. data/lib/active_cached_resource/caching_strategies/active_support_cache.rb +31 -0
  148. data/lib/active_cached_resource/caching_strategies/base.rb +114 -0
  149. data/lib/active_cached_resource/caching_strategies/sql_cache.rb +32 -0
  150. data/lib/active_cached_resource/configuration.rb +50 -0
  151. data/lib/active_cached_resource/logger.rb +22 -0
  152. data/lib/active_cached_resource/model.rb +33 -0
  153. data/lib/active_cached_resource/version.rb +12 -0
  154. data/lib/active_cached_resource.rb +64 -0
  155. data/lib/activeresource/.gitignore +15 -0
  156. data/lib/activeresource/README.md +283 -0
  157. data/lib/activeresource/examples/performance.rb +72 -0
  158. data/lib/activeresource/lib/active_resource/active_job_serializer.rb +26 -0
  159. data/lib/activeresource/lib/active_resource/associations/builder/association.rb +32 -0
  160. data/lib/activeresource/lib/active_resource/associations/builder/belongs_to.rb +16 -0
  161. data/lib/activeresource/lib/active_resource/associations/builder/has_many.rb +14 -0
  162. data/lib/activeresource/lib/active_resource/associations/builder/has_one.rb +14 -0
  163. data/lib/activeresource/lib/active_resource/associations.rb +175 -0
  164. data/lib/activeresource/lib/active_resource/base.rb +1741 -0
  165. data/lib/activeresource/lib/active_resource/callbacks.rb +22 -0
  166. data/lib/activeresource/lib/active_resource/collection.rb +214 -0
  167. data/lib/activeresource/lib/active_resource/connection.rb +298 -0
  168. data/lib/activeresource/lib/active_resource/custom_methods.rb +129 -0
  169. data/lib/activeresource/lib/active_resource/exceptions.rb +98 -0
  170. data/lib/activeresource/lib/active_resource/formats/json_format.rb +28 -0
  171. data/lib/activeresource/lib/active_resource/formats/xml_format.rb +27 -0
  172. data/lib/activeresource/lib/active_resource/formats.rb +24 -0
  173. data/lib/activeresource/lib/active_resource/http_mock.rb +386 -0
  174. data/lib/activeresource/lib/active_resource/inheriting_hash.rb +34 -0
  175. data/lib/activeresource/lib/active_resource/log_subscriber.rb +26 -0
  176. data/lib/activeresource/lib/active_resource/railtie.rb +31 -0
  177. data/lib/activeresource/lib/active_resource/reflection.rb +78 -0
  178. data/lib/activeresource/lib/active_resource/schema.rb +60 -0
  179. data/lib/activeresource/lib/active_resource/singleton.rb +111 -0
  180. data/lib/activeresource/lib/active_resource/threadsafe_attributes.rb +65 -0
  181. data/lib/activeresource/lib/active_resource/validations.rb +176 -0
  182. data/lib/activeresource/lib/active_resource.rb +49 -0
  183. data/lib/activeresource/lib/activeresource.rb +3 -0
  184. data/lib/activeresource/test/abstract_unit.rb +153 -0
  185. data/lib/activeresource/test/cases/active_job_serializer_test.rb +53 -0
  186. data/lib/activeresource/test/cases/association_test.rb +104 -0
  187. data/lib/activeresource/test/cases/associations/builder/belongs_to_test.rb +42 -0
  188. data/lib/activeresource/test/cases/associations/builder/has_many_test.rb +28 -0
  189. data/lib/activeresource/test/cases/associations/builder/has_one_test.rb +28 -0
  190. data/lib/activeresource/test/cases/authorization_test.rb +276 -0
  191. data/lib/activeresource/test/cases/base/custom_methods_test.rb +155 -0
  192. data/lib/activeresource/test/cases/base/equality_test.rb +53 -0
  193. data/lib/activeresource/test/cases/base/load_test.rb +249 -0
  194. data/lib/activeresource/test/cases/base/schema_test.rb +428 -0
  195. data/lib/activeresource/test/cases/base_errors_test.rb +129 -0
  196. data/lib/activeresource/test/cases/base_test.rb +1622 -0
  197. data/lib/activeresource/test/cases/callbacks_test.rb +155 -0
  198. data/lib/activeresource/test/cases/collection_test.rb +172 -0
  199. data/lib/activeresource/test/cases/connection_test.rb +357 -0
  200. data/lib/activeresource/test/cases/finder_test.rb +217 -0
  201. data/lib/activeresource/test/cases/format_test.rb +137 -0
  202. data/lib/activeresource/test/cases/http_mock_test.rb +213 -0
  203. data/lib/activeresource/test/cases/inheritence_test.rb +19 -0
  204. data/lib/activeresource/test/cases/inheriting_hash_test.rb +25 -0
  205. data/lib/activeresource/test/cases/log_subscriber_test.rb +63 -0
  206. data/lib/activeresource/test/cases/reflection_test.rb +65 -0
  207. data/lib/activeresource/test/cases/validations_test.rb +78 -0
  208. data/lib/activeresource/test/fixtures/address.rb +20 -0
  209. data/lib/activeresource/test/fixtures/beast.rb +16 -0
  210. data/lib/activeresource/test/fixtures/comment.rb +5 -0
  211. data/lib/activeresource/test/fixtures/customer.rb +5 -0
  212. data/lib/activeresource/test/fixtures/inventory.rb +14 -0
  213. data/lib/activeresource/test/fixtures/person.rb +15 -0
  214. data/lib/activeresource/test/fixtures/pet.rb +6 -0
  215. data/lib/activeresource/test/fixtures/post.rb +5 -0
  216. data/lib/activeresource/test/fixtures/product.rb +11 -0
  217. data/lib/activeresource/test/fixtures/project.rb +19 -0
  218. data/lib/activeresource/test/fixtures/proxy.rb +6 -0
  219. data/lib/activeresource/test/fixtures/sound.rb +11 -0
  220. data/lib/activeresource/test/fixtures/street_address.rb +6 -0
  221. data/lib/activeresource/test/fixtures/subscription_plan.rb +7 -0
  222. data/lib/activeresource/test/fixtures/weather.rb +21 -0
  223. data/lib/activeresource/test/setter_trap.rb +28 -0
  224. data/lib/activeresource/test/singleton_test.rb +138 -0
  225. data/lib/activeresource/test/threadsafe_attributes_test.rb +91 -0
  226. data/lib/generators/active_cached_resource/install_generator.rb +31 -0
  227. data/lib/generators/active_cached_resource/templates/migration.erb +16 -0
  228. data/sorbet/config +4 -0
  229. data/sorbet/rbi/annotations/.gitattributes +1 -0
  230. data/sorbet/rbi/annotations/activemodel.rbi +89 -0
  231. data/sorbet/rbi/annotations/activesupport.rbi +457 -0
  232. data/sorbet/rbi/annotations/minitest.rbi +119 -0
  233. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  234. data/sorbet/rbi/dsl/.gitattributes +1 -0
  235. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  236. data/sorbet/rbi/gems/.gitattributes +1 -0
  237. data/sorbet/rbi/gems/actioncable@8.0.0.rbi +252 -0
  238. data/sorbet/rbi/gems/actionmailbox@8.0.0.rbi +9 -0
  239. data/sorbet/rbi/gems/actionmailer@8.0.0.rbi +9 -0
  240. data/sorbet/rbi/gems/actionpack@8.0.0.rbi +20909 -0
  241. data/sorbet/rbi/gems/actiontext@8.0.0.rbi +9 -0
  242. data/sorbet/rbi/gems/actionview@8.0.0.rbi +16207 -0
  243. data/sorbet/rbi/gems/activejob@8.0.0.rbi +9 -0
  244. data/sorbet/rbi/gems/activemodel-serializers-xml@1.0.3.rbi +166 -0
  245. data/sorbet/rbi/gems/activemodel@8.0.0.rbi +6857 -0
  246. data/sorbet/rbi/gems/activerecord@8.0.0.rbi +42896 -0
  247. data/sorbet/rbi/gems/activeresource@6.1.4.rbi +3944 -0
  248. data/sorbet/rbi/gems/activestorage@8.0.0.rbi +9 -0
  249. data/sorbet/rbi/gems/activesupport@8.0.0.rbi +21251 -0
  250. data/sorbet/rbi/gems/ast@2.4.2.rbi +585 -0
  251. data/sorbet/rbi/gems/base64@0.2.0.rbi +509 -0
  252. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +618 -0
  253. data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +78 -0
  254. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  255. data/sorbet/rbi/gems/bump@0.10.0.rbi +169 -0
  256. data/sorbet/rbi/gems/byebug@11.1.3.rbi +3607 -0
  257. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3427 -0
  258. data/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi +11645 -0
  259. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +9 -0
  260. data/sorbet/rbi/gems/crass@1.0.6.rbi +623 -0
  261. data/sorbet/rbi/gems/date@3.4.0.rbi +75 -0
  262. data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +1131 -0
  263. data/sorbet/rbi/gems/docile@1.4.1.rbi +377 -0
  264. data/sorbet/rbi/gems/drb@2.2.1.rbi +1347 -0
  265. data/sorbet/rbi/gems/erubi@1.13.0.rbi +150 -0
  266. data/sorbet/rbi/gems/globalid@1.2.1.rbi +9 -0
  267. data/sorbet/rbi/gems/i18n@1.14.6.rbi +2359 -0
  268. data/sorbet/rbi/gems/io-console@0.7.2.rbi +9 -0
  269. data/sorbet/rbi/gems/json@2.8.2.rbi +1901 -0
  270. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14238 -0
  271. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +240 -0
  272. data/sorbet/rbi/gems/logger@1.6.1.rbi +920 -0
  273. data/sorbet/rbi/gems/loofah@2.23.1.rbi +1081 -0
  274. data/sorbet/rbi/gems/mail@2.8.1.rbi +9 -0
  275. data/sorbet/rbi/gems/marcel@1.0.4.rbi +9 -0
  276. data/sorbet/rbi/gems/method_source@1.1.0.rbi +304 -0
  277. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
  278. data/sorbet/rbi/gems/minitest@5.25.2.rbi +1547 -0
  279. data/sorbet/rbi/gems/net-imap@0.5.1.rbi +9 -0
  280. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
  281. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +292 -0
  282. data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +9 -0
  283. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  284. data/sorbet/rbi/gems/nio4r@2.7.4.rbi +9 -0
  285. data/sorbet/rbi/gems/nokogiri@1.16.7.rbi +7311 -0
  286. data/sorbet/rbi/gems/parallel@1.26.3.rbi +291 -0
  287. data/sorbet/rbi/gems/parser@3.3.6.0.rbi +5519 -0
  288. data/sorbet/rbi/gems/prism@1.2.0.rbi +39085 -0
  289. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +1151 -0
  290. data/sorbet/rbi/gems/pry@0.14.2.rbi +10076 -0
  291. data/sorbet/rbi/gems/psych@5.2.0.rbi +1785 -0
  292. data/sorbet/rbi/gems/racc@1.8.1.rbi +162 -0
  293. data/sorbet/rbi/gems/rack-session@2.0.0.rbi +727 -0
  294. data/sorbet/rbi/gems/rack-test@2.1.0.rbi +747 -0
  295. data/sorbet/rbi/gems/rack@3.1.8.rbi +4905 -0
  296. data/sorbet/rbi/gems/rackup@2.2.1.rbi +230 -0
  297. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +758 -0
  298. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +785 -0
  299. data/sorbet/rbi/gems/rails@8.0.0.rbi +9 -0
  300. data/sorbet/rbi/gems/railties@8.0.0.rbi +6287 -0
  301. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +403 -0
  302. data/sorbet/rbi/gems/rake@13.2.1.rbi +3091 -0
  303. data/sorbet/rbi/gems/rbi@0.2.1.rbi +4535 -0
  304. data/sorbet/rbi/gems/rdoc@6.8.1.rbi +12572 -0
  305. data/sorbet/rbi/gems/regexp_parser@2.9.2.rbi +3772 -0
  306. data/sorbet/rbi/gems/reline@0.5.12.rbi +2416 -0
  307. data/sorbet/rbi/gems/rexml@3.3.9.rbi +4858 -0
  308. data/sorbet/rbi/gems/rspec-core@3.13.2.rbi +11287 -0
  309. data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +8183 -0
  310. data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +5341 -0
  311. data/sorbet/rbi/gems/rspec-support@3.13.1.rbi +1630 -0
  312. data/sorbet/rbi/gems/rspec@3.13.0.rbi +83 -0
  313. data/sorbet/rbi/gems/rubocop-ast@1.36.1.rbi +7303 -0
  314. data/sorbet/rbi/gems/rubocop-performance@1.21.1.rbi +9 -0
  315. data/sorbet/rbi/gems/rubocop@1.65.1.rbi +58170 -0
  316. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1318 -0
  317. data/sorbet/rbi/gems/securerandom@0.3.2.rbi +395 -0
  318. data/sorbet/rbi/gems/simplecov-html@0.13.1.rbi +225 -0
  319. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2149 -0
  320. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +9 -0
  321. data/sorbet/rbi/gems/spoom@1.5.0.rbi +4932 -0
  322. data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +9 -0
  323. data/sorbet/rbi/gems/standard-performance@1.4.0.rbi +9 -0
  324. data/sorbet/rbi/gems/standard@1.40.0.rbi +929 -0
  325. data/sorbet/rbi/gems/stringio@3.1.2.rbi +9 -0
  326. data/sorbet/rbi/gems/tapioca@0.16.4.rbi +3597 -0
  327. data/sorbet/rbi/gems/thor@1.3.2.rbi +4378 -0
  328. data/sorbet/rbi/gems/timeout@0.4.2.rbi +151 -0
  329. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
  330. data/sorbet/rbi/gems/unicode-display_width@2.6.0.rbi +66 -0
  331. data/sorbet/rbi/gems/uri@1.0.2.rbi +2377 -0
  332. data/sorbet/rbi/gems/useragent@0.16.10.rbi +9 -0
  333. data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +9 -0
  334. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
  335. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  336. data/sorbet/rbi/gems/yard@0.9.37.rbi +18504 -0
  337. data/sorbet/rbi/gems/zeitwerk@2.7.1.rbi +9 -0
  338. data/sorbet/tapioca/config.yml +13 -0
  339. data/sorbet/tapioca/require.rb +12 -0
  340. metadata +543 -0
@@ -0,0 +1,1081 @@
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
+
8
+ # == Strings and IO Objects as Input
9
+ #
10
+ # The following methods accept any IO object in addition to accepting a string:
11
+ #
12
+ # - Loofah.html4_document
13
+ # - Loofah.html4_fragment
14
+ # - Loofah.scrub_html4_document
15
+ # - Loofah.scrub_html4_fragment
16
+ #
17
+ # - Loofah.html5_document
18
+ # - Loofah.html5_fragment
19
+ # - Loofah.scrub_html5_document
20
+ # - Loofah.scrub_html5_fragment
21
+ #
22
+ # - Loofah.xml_document
23
+ # - Loofah.xml_fragment
24
+ # - Loofah.scrub_xml_document
25
+ # - Loofah.scrub_xml_fragment
26
+ #
27
+ # - Loofah.document
28
+ # - Loofah.fragment
29
+ # - Loofah.scrub_document
30
+ # - Loofah.scrub_fragment
31
+ #
32
+ # That IO object could be a file, or a socket, or a StringIO, or anything that responds to +read+
33
+ # and +close+.
34
+ #
35
+ # source://loofah//lib/loofah.rb#5
36
+ module Loofah
37
+ class << self
38
+ # Shortcut for Loofah::HTML4::Document.parse(*args, &block)
39
+ #
40
+ # This method accepts the same parameters as Nokogiri::HTML4::Document.parse
41
+ #
42
+ # source://loofah//lib/loofah.rb#76
43
+ def document(*args, &block); end
44
+
45
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
46
+ #
47
+ # This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse
48
+ #
49
+ # source://loofah//lib/loofah.rb#83
50
+ def fragment(*args, &block); end
51
+
52
+ # Shortcut for Loofah::HTML4::Document.parse(*args, &block)
53
+ #
54
+ # This method accepts the same parameters as Nokogiri::HTML4::Document.parse
55
+ #
56
+ # source://loofah//lib/loofah.rb#76
57
+ def html4_document(*args, &block); end
58
+
59
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(*args, &block)
60
+ #
61
+ # This method accepts the same parameters as Nokogiri::HTML4::DocumentFragment.parse
62
+ #
63
+ # source://loofah//lib/loofah.rb#83
64
+ def html4_fragment(*args, &block); end
65
+
66
+ # source://loofah//lib/loofah.rb#101
67
+ def html5_document(*args, &block); end
68
+
69
+ # source://loofah//lib/loofah.rb#108
70
+ def html5_fragment(*args, &block); end
71
+
72
+ # @return [Boolean]
73
+ #
74
+ # source://loofah//lib/loofah.rb#7
75
+ def html5_support?; end
76
+
77
+ # A helper to remove extraneous whitespace from text-ified HTML
78
+ #
79
+ # source://loofah//lib/loofah.rb#169
80
+ def remove_extraneous_whitespace(string); end
81
+
82
+ # Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
83
+ #
84
+ # source://loofah//lib/loofah.rb#88
85
+ def scrub_document(string_or_io, method); end
86
+
87
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
88
+ #
89
+ # source://loofah//lib/loofah.rb#93
90
+ def scrub_fragment(string_or_io, method); end
91
+
92
+ # Shortcut for Loofah::HTML4::Document.parse(string_or_io).scrub!(method)
93
+ #
94
+ # source://loofah//lib/loofah.rb#88
95
+ def scrub_html4_document(string_or_io, method); end
96
+
97
+ # Shortcut for Loofah::HTML4::DocumentFragment.parse(string_or_io).scrub!(method)
98
+ #
99
+ # source://loofah//lib/loofah.rb#93
100
+ def scrub_html4_fragment(string_or_io, method); end
101
+
102
+ # source://loofah//lib/loofah.rb#113
103
+ def scrub_html5_document(string_or_io, method); end
104
+
105
+ # source://loofah//lib/loofah.rb#118
106
+ def scrub_html5_fragment(string_or_io, method); end
107
+
108
+ # Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
109
+ #
110
+ # source://loofah//lib/loofah.rb#164
111
+ def scrub_xml_document(string_or_io, method); end
112
+
113
+ # Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
114
+ #
115
+ # source://loofah//lib/loofah.rb#159
116
+ def scrub_xml_fragment(string_or_io, method); end
117
+
118
+ # Shortcut for Loofah::XML::Document.parse(*args, &block)
119
+ #
120
+ # This method accepts the same parameters as Nokogiri::XML::Document.parse
121
+ #
122
+ # source://loofah//lib/loofah.rb#147
123
+ def xml_document(*args, &block); end
124
+
125
+ # Shortcut for Loofah::XML::DocumentFragment.parse(*args, &block)
126
+ #
127
+ # This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse
128
+ #
129
+ # source://loofah//lib/loofah.rb#154
130
+ def xml_fragment(*args, &block); end
131
+ end
132
+ end
133
+
134
+ # source://loofah//lib/loofah/concerns.rb#125
135
+ module Loofah::DocumentDecorator
136
+ # source://loofah//lib/loofah/concerns.rb#126
137
+ def initialize(*args, &block); end
138
+ end
139
+
140
+ # source://loofah//lib/loofah/elements.rb#6
141
+ module Loofah::Elements; end
142
+
143
+ # source://loofah//lib/loofah/elements.rb#93
144
+ Loofah::Elements::BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
145
+
146
+ # Elements that aren't block but should generate a newline in #to_text
147
+ #
148
+ # source://loofah//lib/loofah/elements.rb#90
149
+ Loofah::Elements::INLINE_LINE_BREAK = T.let(T.unsafe(nil), Set)
150
+
151
+ # source://loofah//lib/loofah/elements.rb#94
152
+ Loofah::Elements::LINEBREAKERS = T.let(T.unsafe(nil), Set)
153
+
154
+ # The following elements may also be considered block-level
155
+ # elements since they may contain block-level elements
156
+ #
157
+ # source://loofah//lib/loofah/elements.rb#76
158
+ Loofah::Elements::LOOSE_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
159
+
160
+ # source://loofah//lib/loofah/elements.rb#92
161
+ Loofah::Elements::STRICT_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
162
+
163
+ # source://loofah//lib/loofah/elements.rb#7
164
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML4 = T.let(T.unsafe(nil), Set)
165
+
166
+ # https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
167
+ #
168
+ # source://loofah//lib/loofah/elements.rb#35
169
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML5 = T.let(T.unsafe(nil), Set)
170
+
171
+ # Alias for Loofah::HTML4
172
+ #
173
+ # source://loofah//lib/loofah.rb#70
174
+ Loofah::HTML = Loofah::HTML4
175
+
176
+ # source://loofah//lib/loofah/html4/document.rb#4
177
+ module Loofah::HTML4; end
178
+
179
+ # Subclass of Nokogiri::HTML4::Document.
180
+ #
181
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
182
+ #
183
+ # source://loofah//lib/loofah/html4/document.rb#10
184
+ class Loofah::HTML4::Document < ::Nokogiri::HTML4::Document
185
+ include ::Loofah::ScrubBehavior::Node
186
+ include ::Loofah::DocumentDecorator
187
+ include ::Loofah::TextBehavior
188
+ include ::Loofah::HtmlDocumentBehavior
189
+ extend ::Loofah::HtmlDocumentBehavior::ClassMethods
190
+ end
191
+
192
+ # Subclass of Nokogiri::HTML4::DocumentFragment.
193
+ #
194
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
195
+ #
196
+ # source://loofah//lib/loofah/html4/document_fragment.rb#10
197
+ class Loofah::HTML4::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
198
+ include ::Loofah::TextBehavior
199
+ include ::Loofah::HtmlFragmentBehavior
200
+ extend ::Loofah::HtmlFragmentBehavior::ClassMethods
201
+ end
202
+
203
+ # source://loofah//lib/loofah/html5/safelist.rb#6
204
+ module Loofah::HTML5; end
205
+
206
+ # Subclass of Nokogiri::HTML5::Document.
207
+ #
208
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
209
+ #
210
+ # source://loofah//lib/loofah/html5/document.rb#10
211
+ class Loofah::HTML5::Document < ::Nokogiri::HTML5::Document
212
+ include ::Loofah::ScrubBehavior::Node
213
+ include ::Loofah::DocumentDecorator
214
+ include ::Loofah::TextBehavior
215
+ include ::Loofah::HtmlDocumentBehavior
216
+ extend ::Loofah::HtmlDocumentBehavior::ClassMethods
217
+ end
218
+
219
+ # Subclass of Nokogiri::HTML5::DocumentFragment.
220
+ #
221
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
222
+ #
223
+ # source://loofah//lib/loofah/html5/document_fragment.rb#10
224
+ class Loofah::HTML5::DocumentFragment < ::Nokogiri::HTML5::DocumentFragment
225
+ include ::Loofah::TextBehavior
226
+ include ::Loofah::HtmlFragmentBehavior
227
+ extend ::Loofah::HtmlFragmentBehavior::ClassMethods
228
+ end
229
+
230
+ # source://loofah//lib/loofah/html5/safelist.rb#49
231
+ module Loofah::HTML5::SafeList; end
232
+
233
+ # source://loofah//lib/loofah/html5/safelist.rb#232
234
+ Loofah::HTML5::SafeList::ACCEPTABLE_ATTRIBUTES = T.let(T.unsafe(nil), Set)
235
+
236
+ # https://www.w3.org/TR/css-color-3/#html4
237
+ #
238
+ # source://loofah//lib/loofah/html5/safelist.rb#738
239
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_COLORS = T.let(T.unsafe(nil), Set)
240
+
241
+ # https://www.w3.org/TR/css-color-3/#svg-color
242
+ #
243
+ # source://loofah//lib/loofah/html5/safelist.rb#758
244
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_EXTENDED_COLORS = T.let(T.unsafe(nil), Set)
245
+
246
+ # see https://www.quackit.com/css/functions/
247
+ # omit `url` and `image` from that list
248
+ #
249
+ # source://loofah//lib/loofah/html5/safelist.rb#910
250
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
251
+
252
+ # source://loofah//lib/loofah/html5/safelist.rb#699
253
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
254
+
255
+ # source://loofah//lib/loofah/html5/safelist.rb#626
256
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
257
+
258
+ # source://loofah//lib/loofah/html5/safelist.rb#50
259
+ Loofah::HTML5::SafeList::ACCEPTABLE_ELEMENTS = T.let(T.unsafe(nil), Set)
260
+
261
+ # source://loofah//lib/loofah/html5/safelist.rb#983
262
+ Loofah::HTML5::SafeList::ACCEPTABLE_PROTOCOLS = T.let(T.unsafe(nil), Set)
263
+
264
+ # source://loofah//lib/loofah/html5/safelist.rb#970
265
+ Loofah::HTML5::SafeList::ACCEPTABLE_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
266
+
267
+ # source://loofah//lib/loofah/html5/safelist.rb#1014
268
+ Loofah::HTML5::SafeList::ACCEPTABLE_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
269
+
270
+ # source://loofah//lib/loofah/html5/safelist.rb#1024
271
+ Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES = T.let(T.unsafe(nil), Set)
272
+
273
+ # source://loofah//lib/loofah/html5/safelist.rb#1027
274
+ Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
275
+
276
+ # source://loofah//lib/loofah/html5/safelist.rb#1026
277
+ Loofah::HTML5::SafeList::ALLOWED_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
278
+
279
+ # source://loofah//lib/loofah/html5/safelist.rb#1025
280
+ Loofah::HTML5::SafeList::ALLOWED_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
281
+
282
+ # subclasses may define their own versions of these constants
283
+ #
284
+ # source://loofah//lib/loofah/html5/safelist.rb#1023
285
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS = T.let(T.unsafe(nil), Set)
286
+
287
+ # source://loofah//lib/loofah/html5/safelist.rb#1048
288
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
289
+
290
+ # source://loofah//lib/loofah/html5/safelist.rb#1029
291
+ Loofah::HTML5::SafeList::ALLOWED_PROTOCOLS = T.let(T.unsafe(nil), Set)
292
+
293
+ # source://loofah//lib/loofah/html5/safelist.rb#1028
294
+ Loofah::HTML5::SafeList::ALLOWED_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
295
+
296
+ # source://loofah//lib/loofah/html5/safelist.rb#1030
297
+ Loofah::HTML5::SafeList::ALLOWED_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
298
+
299
+ # source://loofah//lib/loofah/html5/safelist.rb#526
300
+ Loofah::HTML5::SafeList::ARIA_ATTRIBUTES = T.let(T.unsafe(nil), Set)
301
+
302
+ # source://loofah//lib/loofah/html5/safelist.rb#582
303
+ Loofah::HTML5::SafeList::ATTR_VAL_IS_URI = T.let(T.unsafe(nil), Set)
304
+
305
+ # source://loofah//lib/loofah/html5/safelist.rb#315
306
+ Loofah::HTML5::SafeList::MATHML_ATTRIBUTES = T.let(T.unsafe(nil), Set)
307
+
308
+ # source://loofah//lib/loofah/html5/safelist.rb#147
309
+ Loofah::HTML5::SafeList::MATHML_ELEMENTS = T.let(T.unsafe(nil), Set)
310
+
311
+ # source://loofah//lib/loofah/html5/safelist.rb#981
312
+ Loofah::HTML5::SafeList::PROTOCOL_SEPARATOR = T.let(T.unsafe(nil), Regexp)
313
+
314
+ # source://loofah//lib/loofah/html5/safelist.rb#963
315
+ Loofah::HTML5::SafeList::SHORTHAND_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
316
+
317
+ # source://loofah//lib/loofah/html5/safelist.rb#608
318
+ Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF = T.let(T.unsafe(nil), Set)
319
+
320
+ # source://loofah//lib/loofah/html5/safelist.rb#367
321
+ Loofah::HTML5::SafeList::SVG_ATTRIBUTES = T.let(T.unsafe(nil), Set)
322
+
323
+ # source://loofah//lib/loofah/html5/safelist.rb#594
324
+ Loofah::HTML5::SafeList::SVG_ATTR_VAL_ALLOWS_REF = T.let(T.unsafe(nil), Set)
325
+
326
+ # source://loofah//lib/loofah/html5/safelist.rb#183
327
+ Loofah::HTML5::SafeList::SVG_ELEMENTS = T.let(T.unsafe(nil), Set)
328
+
329
+ # additional tags we should consider safe since we have libxml2 fixing up our documents.
330
+ #
331
+ # source://loofah//lib/loofah/html5/safelist.rb#1043
332
+ Loofah::HTML5::SafeList::TAGS_SAFE_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
333
+
334
+ # TODO: remove VOID_ELEMENTS in a future major release
335
+ # and put it in the tests (it is used only for testing, not for functional behavior)
336
+ #
337
+ # source://loofah//lib/loofah/html5/safelist.rb#1034
338
+ Loofah::HTML5::SafeList::VOID_ELEMENTS = T.let(T.unsafe(nil), Set)
339
+
340
+ # source://loofah//lib/loofah/html5/scrub.rb#8
341
+ module Loofah::HTML5::Scrub
342
+ class << self
343
+ # @return [Boolean]
344
+ #
345
+ # source://loofah//lib/loofah/html5/scrub.rb#18
346
+ def allowed_element?(element_name); end
347
+
348
+ # source://loofah//lib/loofah/html5/scrub.rb#192
349
+ def cdata_escape(node); end
350
+
351
+ # @return [Boolean]
352
+ #
353
+ # source://loofah//lib/loofah/html5/scrub.rb#187
354
+ def cdata_needs_escaping?(node); end
355
+
356
+ # source://loofah//lib/loofah/html5/scrub.rb#207
357
+ def escape_tags(string); end
358
+
359
+ # libxml2 >= 2.9.2 fails to escape comments within some attributes.
360
+ #
361
+ # see comments about CVE-2018-8048 within the tests for more information
362
+ #
363
+ # source://loofah//lib/loofah/html5/scrub.rb#166
364
+ def force_correct_attribute_escaping!(node); end
365
+
366
+ # source://loofah//lib/loofah/html5/scrub.rb#123
367
+ def scrub_attribute_that_allows_local_ref(attr_node); end
368
+
369
+ # alternative implementation of the html5lib attribute scrubbing algorithm
370
+ #
371
+ # source://loofah//lib/loofah/html5/scrub.rb#23
372
+ def scrub_attributes(node); end
373
+
374
+ # source://loofah//lib/loofah/html5/scrub.rb#72
375
+ def scrub_css(style); end
376
+
377
+ # source://loofah//lib/loofah/html5/scrub.rb#67
378
+ def scrub_css_attribute(node); end
379
+
380
+ # source://loofah//lib/loofah/html5/scrub.rb#142
381
+ def scrub_uri_attribute(attr_node); end
382
+ end
383
+ end
384
+
385
+ # source://loofah//lib/loofah/html5/scrub.rb#9
386
+ Loofah::HTML5::Scrub::CONTROL_CHARACTERS = T.let(T.unsafe(nil), Regexp)
387
+
388
+ # source://loofah//lib/loofah/html5/scrub.rb#11
389
+ Loofah::HTML5::Scrub::CRASS_SEMICOLON = T.let(T.unsafe(nil), Hash)
390
+
391
+ # source://loofah//lib/loofah/html5/scrub.rb#12
392
+ Loofah::HTML5::Scrub::CSS_IMPORTANT = T.let(T.unsafe(nil), String)
393
+
394
+ # source://loofah//lib/loofah/html5/scrub.rb#10
395
+ Loofah::HTML5::Scrub::CSS_KEYWORDISH = T.let(T.unsafe(nil), Regexp)
396
+
397
+ # source://loofah//lib/loofah/html5/scrub.rb#14
398
+ Loofah::HTML5::Scrub::CSS_PROPERTY_STRING_WITHOUT_EMBEDDED_QUOTES = T.let(T.unsafe(nil), Regexp)
399
+
400
+ # source://loofah//lib/loofah/html5/scrub.rb#13
401
+ Loofah::HTML5::Scrub::CSS_WHITESPACE = T.let(T.unsafe(nil), String)
402
+
403
+ # source://loofah//lib/loofah/html5/scrub.rb#15
404
+ Loofah::HTML5::Scrub::DATA_ATTRIBUTE_NAME = T.let(T.unsafe(nil), Regexp)
405
+
406
+ # source://loofah//lib/loofah/html5/safelist.rb#1051
407
+ Loofah::HTML5::WhiteList = Loofah::HTML5::SafeList
408
+
409
+ # source://loofah//lib/loofah/concerns.rb#133
410
+ module Loofah::HtmlDocumentBehavior
411
+ mixes_in_class_methods ::Loofah::HtmlDocumentBehavior::ClassMethods
412
+
413
+ # source://loofah//lib/loofah/concerns.rb#164
414
+ def serialize_root; end
415
+
416
+ class << self
417
+ # @private
418
+ #
419
+ # source://loofah//lib/loofah/concerns.rb#159
420
+ def included(base); end
421
+ end
422
+ end
423
+
424
+ # source://loofah//lib/loofah/concerns.rb#134
425
+ module Loofah::HtmlDocumentBehavior::ClassMethods
426
+ # source://loofah//lib/loofah/concerns.rb#135
427
+ def parse(*args, &block); end
428
+
429
+ private
430
+
431
+ # remove comments that exist outside of the HTML element.
432
+ #
433
+ # these comments are allowed by the HTML spec:
434
+ #
435
+ # https://www.w3.org/TR/html401/struct/global.html#h-7.1
436
+ #
437
+ # but are not scrubbed by Loofah because these nodes don't meet
438
+ # the contract that scrubbers expect of a node (e.g., it can be
439
+ # replaced, sibling and children nodes can be created).
440
+ #
441
+ # source://loofah//lib/loofah/concerns.rb#150
442
+ def remove_comments_before_html_element(doc); end
443
+ end
444
+
445
+ # source://loofah//lib/loofah/concerns.rb#169
446
+ module Loofah::HtmlFragmentBehavior
447
+ mixes_in_class_methods ::Loofah::HtmlFragmentBehavior::ClassMethods
448
+
449
+ # source://loofah//lib/loofah/concerns.rb#197
450
+ def serialize; end
451
+
452
+ # source://loofah//lib/loofah/concerns.rb#203
453
+ def serialize_root; end
454
+
455
+ # source://loofah//lib/loofah/concerns.rb#197
456
+ def to_s; end
457
+
458
+ class << self
459
+ # @private
460
+ #
461
+ # source://loofah//lib/loofah/concerns.rb#192
462
+ def included(base); end
463
+ end
464
+ end
465
+
466
+ # source://loofah//lib/loofah/concerns.rb#170
467
+ module Loofah::HtmlFragmentBehavior::ClassMethods
468
+ # source://loofah//lib/loofah/concerns.rb#180
469
+ def document_klass; end
470
+
471
+ # source://loofah//lib/loofah/concerns.rb#171
472
+ def parse(tags, encoding = T.unsafe(nil)); end
473
+ end
474
+
475
+ # constants related to working around unhelpful libxml2 behavior
476
+ #
477
+ # ಠ_ಠ
478
+ #
479
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#12
480
+ module Loofah::LibxmlWorkarounds; end
481
+
482
+ # these attributes and qualifying parent tags are determined by the code at:
483
+ #
484
+ # https://git.gnome.org/browse/libxml2/tree/HTMLtree.c?h=v2.9.2#n714
485
+ #
486
+ # see comments about CVE-2018-8048 within the tests for more information
487
+ #
488
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#20
489
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES = T.let(T.unsafe(nil), Set)
490
+
491
+ # source://loofah//lib/loofah/html5/libxml2_workarounds.rb#26
492
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = T.let(T.unsafe(nil), Hash)
493
+
494
+ # source://loofah//lib/loofah/metahelpers.rb#4
495
+ module Loofah::MetaHelpers
496
+ class << self
497
+ # source://loofah//lib/loofah/metahelpers.rb#6
498
+ def add_downcased_set_members_to_all_set_constants(mojule); end
499
+ end
500
+ end
501
+
502
+ # Mixes +scrub!+ into Document, DocumentFragment, Node and NodeSet.
503
+ #
504
+ # Traverse the document or fragment, invoking the +scrubber+ on each node.
505
+ #
506
+ # +scrubber+ must either be one of the symbols representing the built-in scrubbers (see
507
+ # Scrubbers), or a Scrubber instance.
508
+ #
509
+ # span2div = Loofah::Scrubber.new do |node|
510
+ # node.name = "div" if node.name == "span"
511
+ # end
512
+ # Loofah.html5_fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
513
+ # # => "<div>foo</div><p>bar</p>"
514
+ #
515
+ # or
516
+ #
517
+ # unsafe_html = "ohai! <div>div is safe</div> <script>but script is not</script>"
518
+ # Loofah.html5_fragment(unsafe_html).scrub!(:strip).to_s
519
+ # # => "ohai! <div>div is safe</div> "
520
+ #
521
+ # Note that this method is called implicitly from the shortcuts Loofah.scrub_html5_fragment et
522
+ # al.
523
+ #
524
+ # Please see Scrubber for more information on implementation and traversal, and README.rdoc for
525
+ # more example usage.
526
+ #
527
+ # source://loofah//lib/loofah/concerns.rb#30
528
+ module Loofah::ScrubBehavior
529
+ class << self
530
+ # source://loofah//lib/loofah/concerns.rb#59
531
+ def resolve_scrubber(scrubber); end
532
+ end
533
+ end
534
+
535
+ # source://loofah//lib/loofah/concerns.rb#31
536
+ module Loofah::ScrubBehavior::Node
537
+ # source://loofah//lib/loofah/concerns.rb#32
538
+ def scrub!(scrubber); end
539
+ end
540
+
541
+ # source://loofah//lib/loofah/concerns.rb#51
542
+ module Loofah::ScrubBehavior::NodeSet
543
+ # source://loofah//lib/loofah/concerns.rb#52
544
+ def scrub!(scrubber); end
545
+ end
546
+
547
+ # A Scrubber wraps up a block (or method) that is run on an HTML node (element):
548
+ #
549
+ # # change all <span> tags to <div> tags
550
+ # span2div = Loofah::Scrubber.new do |node|
551
+ # node.name = "div" if node.name == "span"
552
+ # end
553
+ #
554
+ # Alternatively, this scrubber could have been implemented as:
555
+ #
556
+ # class Span2Div < Loofah::Scrubber
557
+ # def scrub(node)
558
+ # node.name = "div" if node.name == "span"
559
+ # end
560
+ # end
561
+ # span2div = Span2Div.new
562
+ #
563
+ # This can then be run on a document:
564
+ #
565
+ # Loofah.html5_fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
566
+ # # => "<div>foo</div><p>bar</p>"
567
+ #
568
+ # Scrubbers can be run on a document in either a top-down traversal (the
569
+ # default) or bottom-up. Top-down scrubbers can optionally return
570
+ # Scrubber::STOP to terminate the traversal of a subtree.
571
+ #
572
+ # source://loofah//lib/loofah/scrubber.rb#35
573
+ class Loofah::Scrubber
574
+ # Options may include
575
+ # :direction => :top_down (the default)
576
+ # or
577
+ # :direction => :bottom_up
578
+ #
579
+ # For top_down traversals, if the block returns
580
+ # Loofah::Scrubber::STOP, then the traversal will be terminated
581
+ # for the current node's subtree.
582
+ #
583
+ # Alternatively, a Scrubber may inherit from Loofah::Scrubber,
584
+ # and implement +scrub+, which is slightly faster than using a
585
+ # block.
586
+ #
587
+ # @return [Scrubber] a new instance of Scrubber
588
+ #
589
+ # source://loofah//lib/loofah/scrubber.rb#65
590
+ def initialize(options = T.unsafe(nil), &block); end
591
+
592
+ # If the attribute is not set, add it
593
+ # If the attribute is set, don't overwrite the existing value
594
+ #
595
+ # source://loofah//lib/loofah/scrubber.rb#96
596
+ def append_attribute(node, attribute, value); end
597
+
598
+ # When a scrubber is initialized, the optional block is saved as
599
+ # :block. Note that, if no block is passed, then the +scrub+
600
+ # method is assumed to have been implemented.
601
+ #
602
+ # source://loofah//lib/loofah/scrubber.rb#49
603
+ def block; end
604
+
605
+ # When a scrubber is initialized, the :direction may be specified
606
+ # as :top_down (the default) or :bottom_up.
607
+ #
608
+ # source://loofah//lib/loofah/scrubber.rb#44
609
+ def direction; end
610
+
611
+ # When +new+ is not passed a block, the class may implement
612
+ # +scrub+, which will be called for each document node.
613
+ #
614
+ # @raise [ScrubberNotFound]
615
+ #
616
+ # source://loofah//lib/loofah/scrubber.rb#88
617
+ def scrub(node); end
618
+
619
+ # Calling +traverse+ will cause the document to be traversed by
620
+ # either the lambda passed to the initializer or the +scrub+
621
+ # method, in the direction specified at +new+ time.
622
+ #
623
+ # source://loofah//lib/loofah/scrubber.rb#80
624
+ def traverse(node); end
625
+
626
+ private
627
+
628
+ # source://loofah//lib/loofah/scrubber.rb#105
629
+ def html5lib_sanitize(node); end
630
+
631
+ # source://loofah//lib/loofah/scrubber.rb#131
632
+ def traverse_conditionally_bottom_up(node); end
633
+
634
+ # source://loofah//lib/loofah/scrubber.rb#122
635
+ def traverse_conditionally_top_down(node); end
636
+ end
637
+
638
+ # Top-down Scrubbers may return CONTINUE to indicate that the subtree should be traversed.
639
+ #
640
+ # source://loofah//lib/loofah/scrubber.rb#37
641
+ Loofah::Scrubber::CONTINUE = T.let(T.unsafe(nil), Object)
642
+
643
+ # Top-down Scrubbers may return STOP to indicate that the subtree should not be traversed.
644
+ #
645
+ # source://loofah//lib/loofah/scrubber.rb#40
646
+ Loofah::Scrubber::STOP = T.let(T.unsafe(nil), Object)
647
+
648
+ # A RuntimeError raised when Loofah could not find an appropriate scrubber.
649
+ #
650
+ # source://loofah//lib/loofah/scrubber.rb#7
651
+ class Loofah::ScrubberNotFound < ::RuntimeError; end
652
+
653
+ # Loofah provides some built-in scrubbers for sanitizing with
654
+ # HTML5lib's safelist and for accomplishing some common
655
+ # transformation tasks.
656
+ #
657
+ #
658
+ # === Loofah::Scrubbers::Strip / scrub!(:strip)
659
+ #
660
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
661
+ #
662
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
663
+ # Loofah.html5_fragment(unsafe_html).scrub!(:strip)
664
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
665
+ #
666
+ #
667
+ # === Loofah::Scrubbers::Prune / scrub!(:prune)
668
+ #
669
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
670
+ #
671
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
672
+ # Loofah.html5_fragment(unsafe_html).scrub!(:prune)
673
+ # => "ohai! <div>div is safe</div> "
674
+ #
675
+ #
676
+ # === Loofah::Scrubbers::Escape / scrub!(:escape)
677
+ #
678
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
679
+ #
680
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
681
+ # Loofah.html5_fragment(unsafe_html).scrub!(:escape)
682
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
683
+ #
684
+ #
685
+ # === Loofah::Scrubbers::Whitewash / scrub!(:whitewash)
686
+ #
687
+ # +:whitewash+ removes all comments, styling and attributes in
688
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
689
+ # like to call this "whitewashing", since it's like putting a new
690
+ # layer of paint on top of the HTML input to make it look nice.
691
+ #
692
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
693
+ # Loofah.html5_fragment(messy_markup).scrub!(:whitewash)
694
+ # => "ohai! <div>div with attributes</div>"
695
+ #
696
+ # One use case for this scrubber is to clean up HTML that was
697
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
698
+ # rich text editor. Microsoft's software is famous for injecting
699
+ # all kinds of cruft into its HTML output. Who needs that crap?
700
+ # Certainly not me.
701
+ #
702
+ #
703
+ # === Loofah::Scrubbers::NoFollow / scrub!(:nofollow)
704
+ #
705
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
706
+ #
707
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
708
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:nofollow)
709
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
710
+ #
711
+ #
712
+ # === Loofah::Scrubbers::TargetBlank / scrub!(:targetblank)
713
+ #
714
+ # +:targetblank+ adds a target="_blank" attribute to all links
715
+ #
716
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
717
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:targetblank)
718
+ # => "ohai! <a href='http://www.myswarmysite.com/' target="_blank">I like your blog post</a>"
719
+ #
720
+ #
721
+ # === Loofah::Scrubbers::NoOpener / scrub!(:noopener)
722
+ #
723
+ # +:noopener+ adds a rel="noopener" attribute to all links
724
+ #
725
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
726
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noopener)
727
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
728
+ #
729
+ # === Loofah::Scrubbers::NoReferrer / scrub!(:noreferrer)
730
+ #
731
+ # +:noreferrer+ adds a rel="noreferrer" attribute to all links
732
+ #
733
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
734
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noreferrer)
735
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noreferrer">I like your blog post</a>"
736
+ #
737
+ #
738
+ # === Loofah::Scrubbers::Unprintable / scrub!(:unprintable)
739
+ #
740
+ # +:unprintable+ removes unprintable Unicode characters.
741
+ #
742
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
743
+ # Loofah.html5_fragment(markup).scrub!(:unprintable)
744
+ # => "<p>Some text with an unprintable character at the end</p>"
745
+ #
746
+ # You may not be able to see the unprintable character in the above example, but there is a
747
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
748
+ # the content is ever parsed by JavaScript - more information here:
749
+ #
750
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
751
+ #
752
+ # source://loofah//lib/loofah/scrubbers.rb#104
753
+ module Loofah::Scrubbers
754
+ class << self
755
+ # Returns an array of symbols representing the built-in scrubbers
756
+ #
757
+ # source://loofah//lib/loofah/scrubbers.rb#371
758
+ def scrubber_symbols; end
759
+ end
760
+ end
761
+
762
+ # === scrub!(:escape)
763
+ #
764
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
765
+ #
766
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
767
+ # Loofah.html5_fragment(unsafe_html).scrub!(:escape)
768
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
769
+ #
770
+ # source://loofah//lib/loofah/scrubbers.rb#159
771
+ class Loofah::Scrubbers::Escape < ::Loofah::Scrubber
772
+ # @return [Escape] a new instance of Escape
773
+ #
774
+ # source://loofah//lib/loofah/scrubbers.rb#160
775
+ def initialize; end
776
+
777
+ # source://loofah//lib/loofah/scrubbers.rb#164
778
+ def scrub(node); end
779
+ end
780
+
781
+ # A hash that maps a symbol (like +:prune+) to the appropriate Scrubber (Loofah::Scrubbers::Prune).
782
+ #
783
+ # source://loofah//lib/loofah/scrubbers.rb#354
784
+ Loofah::Scrubbers::MAP = T.let(T.unsafe(nil), Hash)
785
+
786
+ # This class probably isn't useful publicly, but is used for #to_text's current implemention
787
+ #
788
+ # source://loofah//lib/loofah/scrubbers.rb#305
789
+ class Loofah::Scrubbers::NewlineBlockElements < ::Loofah::Scrubber
790
+ # @return [NewlineBlockElements] a new instance of NewlineBlockElements
791
+ #
792
+ # source://loofah//lib/loofah/scrubbers.rb#306
793
+ def initialize; end
794
+
795
+ # source://loofah//lib/loofah/scrubbers.rb#310
796
+ def scrub(node); end
797
+ end
798
+
799
+ # === scrub!(:nofollow)
800
+ #
801
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
802
+ #
803
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
804
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:nofollow)
805
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
806
+ #
807
+ # source://loofah//lib/loofah/scrubbers.rb#220
808
+ class Loofah::Scrubbers::NoFollow < ::Loofah::Scrubber
809
+ # @return [NoFollow] a new instance of NoFollow
810
+ #
811
+ # source://loofah//lib/loofah/scrubbers.rb#221
812
+ def initialize; end
813
+
814
+ # source://loofah//lib/loofah/scrubbers.rb#225
815
+ def scrub(node); end
816
+ end
817
+
818
+ # === scrub!(:noopener)
819
+ #
820
+ # +:noopener+ adds a rel="noopener" attribute to all links
821
+ #
822
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
823
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noopener)
824
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
825
+ #
826
+ # source://loofah//lib/loofah/scrubbers.rb#269
827
+ class Loofah::Scrubbers::NoOpener < ::Loofah::Scrubber
828
+ # @return [NoOpener] a new instance of NoOpener
829
+ #
830
+ # source://loofah//lib/loofah/scrubbers.rb#270
831
+ def initialize; end
832
+
833
+ # source://loofah//lib/loofah/scrubbers.rb#274
834
+ def scrub(node); end
835
+ end
836
+
837
+ # === scrub!(:noreferrer)
838
+ #
839
+ # +:noreferrer+ adds a rel="noreferrer" attribute to all links
840
+ #
841
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
842
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:noreferrer)
843
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noreferrer">I like your blog post</a>"
844
+ #
845
+ # source://loofah//lib/loofah/scrubbers.rb#291
846
+ class Loofah::Scrubbers::NoReferrer < ::Loofah::Scrubber
847
+ # @return [NoReferrer] a new instance of NoReferrer
848
+ #
849
+ # source://loofah//lib/loofah/scrubbers.rb#292
850
+ def initialize; end
851
+
852
+ # source://loofah//lib/loofah/scrubbers.rb#296
853
+ def scrub(node); end
854
+ end
855
+
856
+ # === scrub!(:prune)
857
+ #
858
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
859
+ #
860
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
861
+ # Loofah.html5_fragment(unsafe_html).scrub!(:prune)
862
+ # => "ohai! <div>div is safe</div> "
863
+ #
864
+ # source://loofah//lib/loofah/scrubbers.rb#137
865
+ class Loofah::Scrubbers::Prune < ::Loofah::Scrubber
866
+ # @return [Prune] a new instance of Prune
867
+ #
868
+ # source://loofah//lib/loofah/scrubbers.rb#138
869
+ def initialize; end
870
+
871
+ # source://loofah//lib/loofah/scrubbers.rb#142
872
+ def scrub(node); end
873
+ end
874
+
875
+ # === scrub!(:strip)
876
+ #
877
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
878
+ #
879
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
880
+ # Loofah.html5_fragment(unsafe_html).scrub!(:strip)
881
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
882
+ #
883
+ # source://loofah//lib/loofah/scrubbers.rb#114
884
+ class Loofah::Scrubbers::Strip < ::Loofah::Scrubber
885
+ # @return [Strip] a new instance of Strip
886
+ #
887
+ # source://loofah//lib/loofah/scrubbers.rb#115
888
+ def initialize; end
889
+
890
+ # source://loofah//lib/loofah/scrubbers.rb#119
891
+ def scrub(node); end
892
+ end
893
+
894
+ # === scrub!(:targetblank)
895
+ #
896
+ # +:targetblank+ adds a target="_blank" attribute to all links.
897
+ # If there is a target already set, replaces it with target="_blank".
898
+ #
899
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
900
+ # Loofah.html5_fragment(link_farmers_markup).scrub!(:targetblank)
901
+ # => "ohai! <a href='http://www.myswarmysite.com/' target="_blank">I like your blog post</a>"
902
+ #
903
+ # On modern browsers, setting target="_blank" on anchor elements implicitly provides the same
904
+ # behavior as setting rel="noopener".
905
+ #
906
+ # source://loofah//lib/loofah/scrubbers.rb#246
907
+ class Loofah::Scrubbers::TargetBlank < ::Loofah::Scrubber
908
+ # @return [TargetBlank] a new instance of TargetBlank
909
+ #
910
+ # source://loofah//lib/loofah/scrubbers.rb#247
911
+ def initialize; end
912
+
913
+ # source://loofah//lib/loofah/scrubbers.rb#251
914
+ def scrub(node); end
915
+ end
916
+
917
+ # === scrub!(:unprintable)
918
+ #
919
+ # +:unprintable+ removes unprintable Unicode characters.
920
+ #
921
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
922
+ # Loofah.html5_fragment(markup).scrub!(:unprintable)
923
+ # => "<p>Some text with an unprintable character at the end</p>"
924
+ #
925
+ # You may not be able to see the unprintable character in the above example, but there is a
926
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
927
+ # the content is ever parsed by JavaScript - more information here:
928
+ #
929
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
930
+ #
931
+ # source://loofah//lib/loofah/scrubbers.rb#338
932
+ class Loofah::Scrubbers::Unprintable < ::Loofah::Scrubber
933
+ # @return [Unprintable] a new instance of Unprintable
934
+ #
935
+ # source://loofah//lib/loofah/scrubbers.rb#339
936
+ def initialize; end
937
+
938
+ # source://loofah//lib/loofah/scrubbers.rb#343
939
+ def scrub(node); end
940
+ end
941
+
942
+ # === scrub!(:whitewash)
943
+ #
944
+ # +:whitewash+ removes all comments, styling and attributes in
945
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
946
+ # like to call this "whitewashing", since it's like putting a new
947
+ # layer of paint on top of the HTML input to make it look nice.
948
+ #
949
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
950
+ # Loofah.html5_fragment(messy_markup).scrub!(:whitewash)
951
+ # => "ohai! <div>div with attributes</div>"
952
+ #
953
+ # One use case for this scrubber is to clean up HTML that was
954
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
955
+ # rich text editor. Microsoft's software is famous for injecting
956
+ # all kinds of cruft into its HTML output. Who needs that crap?
957
+ # Certainly not me.
958
+ #
959
+ # source://loofah//lib/loofah/scrubbers.rb#191
960
+ class Loofah::Scrubbers::Whitewash < ::Loofah::Scrubber
961
+ # @return [Whitewash] a new instance of Whitewash
962
+ #
963
+ # source://loofah//lib/loofah/scrubbers.rb#192
964
+ def initialize; end
965
+
966
+ # source://loofah//lib/loofah/scrubbers.rb#196
967
+ def scrub(node); end
968
+ end
969
+
970
+ # Overrides +text+ in Document and DocumentFragment classes, and mixes in +to_text+.
971
+ #
972
+ # source://loofah//lib/loofah/concerns.rb#73
973
+ module Loofah::TextBehavior
974
+ # Returns a plain-text version of the markup contained by the document, with HTML entities
975
+ # encoded.
976
+ #
977
+ # This method is significantly faster than #to_text, but isn't clever about whitespace around
978
+ # block elements.
979
+ #
980
+ # Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
981
+ # # => "TitleContent"
982
+ #
983
+ # By default, the returned text will have HTML entities escaped. If you want unescaped
984
+ # entities, and you understand that the result is unsafe to render in a browser, then you can
985
+ # pass an argument as shown:
986
+ #
987
+ # frag = Loofah.html5_fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
988
+ # # ok for browser:
989
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
990
+ # # decidedly not ok for browser:
991
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
992
+ #
993
+ # source://loofah//lib/loofah/concerns.rb#94
994
+ def inner_text(options = T.unsafe(nil)); end
995
+
996
+ # Returns a plain-text version of the markup contained by the document, with HTML entities
997
+ # encoded.
998
+ #
999
+ # This method is significantly faster than #to_text, but isn't clever about whitespace around
1000
+ # block elements.
1001
+ #
1002
+ # Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
1003
+ # # => "TitleContent"
1004
+ #
1005
+ # By default, the returned text will have HTML entities escaped. If you want unescaped
1006
+ # entities, and you understand that the result is unsafe to render in a browser, then you can
1007
+ # pass an argument as shown:
1008
+ #
1009
+ # frag = Loofah.html5_fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
1010
+ # # ok for browser:
1011
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
1012
+ # # decidedly not ok for browser:
1013
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
1014
+ #
1015
+ # source://loofah//lib/loofah/concerns.rb#94
1016
+ def text(options = T.unsafe(nil)); end
1017
+
1018
+ # Returns a plain-text version of the markup contained by the document, with HTML entities
1019
+ # encoded.
1020
+ #
1021
+ # This method is significantly faster than #to_text, but isn't clever about whitespace around
1022
+ # block elements.
1023
+ #
1024
+ # Loofah.html5_document("<h1>Title</h1><div>Content</div>").text
1025
+ # # => "TitleContent"
1026
+ #
1027
+ # By default, the returned text will have HTML entities escaped. If you want unescaped
1028
+ # entities, and you understand that the result is unsafe to render in a browser, then you can
1029
+ # pass an argument as shown:
1030
+ #
1031
+ # frag = Loofah.html5_fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
1032
+ # # ok for browser:
1033
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
1034
+ # # decidedly not ok for browser:
1035
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
1036
+ #
1037
+ # source://loofah//lib/loofah/concerns.rb#94
1038
+ def to_str(options = T.unsafe(nil)); end
1039
+
1040
+ # Returns a plain-text version of the markup contained by the fragment, with HTML entities
1041
+ # encoded.
1042
+ #
1043
+ # This method is slower than #text, but is clever about whitespace around block elements and
1044
+ # line break elements.
1045
+ #
1046
+ # Loofah.html5_document("<h1>Title</h1><div>Content<br>Next line</div>").to_text
1047
+ # # => "\nTitle\n\nContent\nNext line\n"
1048
+ #
1049
+ # source://loofah//lib/loofah/concerns.rb#120
1050
+ def to_text(options = T.unsafe(nil)); end
1051
+ end
1052
+
1053
+ # The version of Loofah you are using
1054
+ #
1055
+ # source://loofah//lib/loofah/version.rb#5
1056
+ Loofah::VERSION = T.let(T.unsafe(nil), String)
1057
+
1058
+ # source://loofah//lib/loofah/xml/document.rb#4
1059
+ module Loofah::XML; end
1060
+
1061
+ # Subclass of Nokogiri::XML::Document.
1062
+ #
1063
+ # See Loofah::ScrubBehavior and Loofah::DocumentDecorator for additional methods.
1064
+ #
1065
+ # source://loofah//lib/loofah/xml/document.rb#10
1066
+ class Loofah::XML::Document < ::Nokogiri::XML::Document
1067
+ include ::Loofah::ScrubBehavior::Node
1068
+ include ::Loofah::DocumentDecorator
1069
+ end
1070
+
1071
+ # Subclass of Nokogiri::XML::DocumentFragment.
1072
+ #
1073
+ # See Loofah::ScrubBehavior for additional methods.
1074
+ #
1075
+ # source://loofah//lib/loofah/xml/document_fragment.rb#10
1076
+ class Loofah::XML::DocumentFragment < ::Nokogiri::XML::DocumentFragment
1077
+ class << self
1078
+ # source://loofah//lib/loofah/xml/document_fragment.rb#12
1079
+ def parse(tags); end
1080
+ end
1081
+ end