active_cached_resource 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (316) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE +21 -0
  4. data/lib/active_cached_resource/caching.rb +104 -1
  5. data/lib/active_cached_resource/configuration.rb +22 -1
  6. data/lib/active_cached_resource/logger.rb +14 -0
  7. data/lib/active_cached_resource/model.rb +18 -0
  8. data/lib/active_cached_resource/version.rb +1 -8
  9. metadata +2 -308
  10. data/.rspec +0 -3
  11. data/.rubocop.yml +0 -23
  12. data/.standard.yml +0 -2
  13. data/Rakefile +0 -29
  14. data/example/consumer/.dockerignore +0 -41
  15. data/example/consumer/.gitattributes +0 -9
  16. data/example/consumer/.gitignore +0 -36
  17. data/example/consumer/.kamal/hooks/docker-setup.sample +0 -3
  18. data/example/consumer/.kamal/hooks/post-deploy.sample +0 -14
  19. data/example/consumer/.kamal/hooks/post-proxy-reboot.sample +0 -3
  20. data/example/consumer/.kamal/hooks/pre-build.sample +0 -51
  21. data/example/consumer/.kamal/hooks/pre-connect.sample +0 -47
  22. data/example/consumer/.kamal/hooks/pre-deploy.sample +0 -109
  23. data/example/consumer/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  24. data/example/consumer/.kamal/secrets +0 -17
  25. data/example/consumer/Dockerfile +0 -65
  26. data/example/consumer/Gemfile +0 -17
  27. data/example/consumer/Rakefile +0 -6
  28. data/example/consumer/app/controllers/application_controller.rb +0 -2
  29. data/example/consumer/app/controllers/concerns/.keep +0 -0
  30. data/example/consumer/app/jobs/application_job.rb +0 -7
  31. data/example/consumer/app/mailers/application_mailer.rb +0 -4
  32. data/example/consumer/app/models/application_record.rb +0 -3
  33. data/example/consumer/app/models/concerns/.keep +0 -0
  34. data/example/consumer/app/models/person.rb +0 -9
  35. data/example/consumer/app/views/layouts/mailer.html.erb +0 -13
  36. data/example/consumer/app/views/layouts/mailer.text.erb +0 -1
  37. data/example/consumer/bin/brakeman +0 -7
  38. data/example/consumer/bin/bundle +0 -109
  39. data/example/consumer/bin/dev +0 -2
  40. data/example/consumer/bin/docker-entrypoint +0 -14
  41. data/example/consumer/bin/jobs +0 -6
  42. data/example/consumer/bin/kamal +0 -27
  43. data/example/consumer/bin/rails +0 -4
  44. data/example/consumer/bin/rake +0 -4
  45. data/example/consumer/bin/rubocop +0 -8
  46. data/example/consumer/bin/setup +0 -34
  47. data/example/consumer/bin/thrust +0 -5
  48. data/example/consumer/config/application.rb +0 -20
  49. data/example/consumer/config/boot.rb +0 -3
  50. data/example/consumer/config/cache.yml +0 -16
  51. data/example/consumer/config/credentials.yml.enc +0 -1
  52. data/example/consumer/config/database.yml +0 -14
  53. data/example/consumer/config/deploy.yml +0 -116
  54. data/example/consumer/config/environment.rb +0 -5
  55. data/example/consumer/config/environments/development.rb +0 -64
  56. data/example/consumer/config/environments/production.rb +0 -85
  57. data/example/consumer/config/environments/test.rb +0 -50
  58. data/example/consumer/config/initializers/cors.rb +0 -16
  59. data/example/consumer/config/initializers/filter_parameter_logging.rb +0 -8
  60. data/example/consumer/config/initializers/inflections.rb +0 -16
  61. data/example/consumer/config/locales/en.yml +0 -31
  62. data/example/consumer/config/puma.rb +0 -41
  63. data/example/consumer/config/queue.yml +0 -18
  64. data/example/consumer/config/recurring.yml +0 -10
  65. data/example/consumer/config/routes.rb +0 -10
  66. data/example/consumer/config.ru +0 -6
  67. data/example/consumer/db/cache_schema.rb +0 -14
  68. data/example/consumer/db/queue_schema.rb +0 -129
  69. data/example/consumer/db/seeds.rb +0 -0
  70. data/example/consumer/lib/tasks/.keep +0 -0
  71. data/example/consumer/log/.keep +0 -0
  72. data/example/consumer/public/robots.txt +0 -1
  73. data/example/consumer/script/.keep +0 -0
  74. data/example/consumer/storage/.keep +0 -0
  75. data/example/consumer/tmp/.keep +0 -0
  76. data/example/consumer/tmp/cache/.keep +0 -0
  77. data/example/consumer/tmp/pids/.keep +0 -0
  78. data/example/consumer/tmp/storage/.keep +0 -0
  79. data/example/consumer/vendor/.keep +0 -0
  80. data/example/provider/.dockerignore +0 -41
  81. data/example/provider/.gitattributes +0 -9
  82. data/example/provider/.gitignore +0 -32
  83. data/example/provider/.kamal/hooks/docker-setup.sample +0 -3
  84. data/example/provider/.kamal/hooks/post-deploy.sample +0 -14
  85. data/example/provider/.kamal/hooks/post-proxy-reboot.sample +0 -3
  86. data/example/provider/.kamal/hooks/pre-build.sample +0 -51
  87. data/example/provider/.kamal/hooks/pre-connect.sample +0 -47
  88. data/example/provider/.kamal/hooks/pre-deploy.sample +0 -109
  89. data/example/provider/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  90. data/example/provider/.kamal/secrets +0 -17
  91. data/example/provider/Dockerfile +0 -65
  92. data/example/provider/Gemfile +0 -14
  93. data/example/provider/Rakefile +0 -6
  94. data/example/provider/app/controllers/application_controller.rb +0 -2
  95. data/example/provider/app/controllers/concerns/.keep +0 -0
  96. data/example/provider/app/controllers/people_controller.rb +0 -68
  97. data/example/provider/app/jobs/application_job.rb +0 -7
  98. data/example/provider/app/mailers/application_mailer.rb +0 -4
  99. data/example/provider/app/models/address.rb +0 -3
  100. data/example/provider/app/models/application_record.rb +0 -3
  101. data/example/provider/app/models/company.rb +0 -3
  102. data/example/provider/app/models/concerns/.keep +0 -0
  103. data/example/provider/app/models/person.rb +0 -6
  104. data/example/provider/app/views/layouts/mailer.html.erb +0 -13
  105. data/example/provider/app/views/layouts/mailer.text.erb +0 -1
  106. data/example/provider/bin/brakeman +0 -7
  107. data/example/provider/bin/bundle +0 -109
  108. data/example/provider/bin/dev +0 -2
  109. data/example/provider/bin/docker-entrypoint +0 -14
  110. data/example/provider/bin/jobs +0 -6
  111. data/example/provider/bin/kamal +0 -27
  112. data/example/provider/bin/rails +0 -4
  113. data/example/provider/bin/rake +0 -4
  114. data/example/provider/bin/rubocop +0 -8
  115. data/example/provider/bin/setup +0 -34
  116. data/example/provider/bin/thrust +0 -5
  117. data/example/provider/config/application.rb +0 -44
  118. data/example/provider/config/boot.rb +0 -3
  119. data/example/provider/config/cache.yml +0 -16
  120. data/example/provider/config/credentials.yml.enc +0 -1
  121. data/example/provider/config/database.yml +0 -20
  122. data/example/provider/config/deploy.yml +0 -116
  123. data/example/provider/config/environment.rb +0 -5
  124. data/example/provider/config/environments/development.rb +0 -64
  125. data/example/provider/config/environments/production.rb +0 -85
  126. data/example/provider/config/environments/test.rb +0 -50
  127. data/example/provider/config/initializers/cors.rb +0 -16
  128. data/example/provider/config/initializers/filter_parameter_logging.rb +0 -8
  129. data/example/provider/config/initializers/inflections.rb +0 -16
  130. data/example/provider/config/locales/en.yml +0 -31
  131. data/example/provider/config/puma.rb +0 -41
  132. data/example/provider/config/queue.yml +0 -18
  133. data/example/provider/config/recurring.yml +0 -10
  134. data/example/provider/config/routes.rb +0 -4
  135. data/example/provider/config.ru +0 -6
  136. data/example/provider/db/cache_schema.rb +0 -14
  137. data/example/provider/db/migrate/20241202183937_create_people.rb +0 -11
  138. data/example/provider/db/migrate/20241202183955_create_addresses.rb +0 -13
  139. data/example/provider/db/migrate/20241202184017_create_companies.rb +0 -14
  140. data/example/provider/db/queue_schema.rb +0 -129
  141. data/example/provider/db/schema.rb +0 -47
  142. data/example/provider/db/seeds.rb +0 -18
  143. data/example/provider/lib/tasks/.keep +0 -0
  144. data/example/provider/log/.keep +0 -0
  145. data/example/provider/public/robots.txt +0 -1
  146. data/example/provider/script/.keep +0 -0
  147. data/example/provider/storage/.keep +0 -0
  148. data/example/provider/tmp/.keep +0 -0
  149. data/example/provider/tmp/pids/.keep +0 -0
  150. data/example/provider/tmp/storage/.keep +0 -0
  151. data/example/provider/vendor/.keep +0 -0
  152. data/lib/activeresource/.gitignore +0 -15
  153. data/lib/activeresource/examples/performance.rb +0 -72
  154. data/lib/activeresource/test/abstract_unit.rb +0 -154
  155. data/lib/activeresource/test/cases/active_job_serializer_test.rb +0 -53
  156. data/lib/activeresource/test/cases/association_test.rb +0 -104
  157. data/lib/activeresource/test/cases/associations/builder/belongs_to_test.rb +0 -42
  158. data/lib/activeresource/test/cases/associations/builder/has_many_test.rb +0 -28
  159. data/lib/activeresource/test/cases/associations/builder/has_one_test.rb +0 -28
  160. data/lib/activeresource/test/cases/authorization_test.rb +0 -276
  161. data/lib/activeresource/test/cases/base/custom_methods_test.rb +0 -155
  162. data/lib/activeresource/test/cases/base/equality_test.rb +0 -53
  163. data/lib/activeresource/test/cases/base/load_test.rb +0 -249
  164. data/lib/activeresource/test/cases/base/schema_test.rb +0 -428
  165. data/lib/activeresource/test/cases/base_errors_test.rb +0 -129
  166. data/lib/activeresource/test/cases/base_test.rb +0 -1622
  167. data/lib/activeresource/test/cases/callbacks_test.rb +0 -155
  168. data/lib/activeresource/test/cases/collection_test.rb +0 -196
  169. data/lib/activeresource/test/cases/connection_test.rb +0 -357
  170. data/lib/activeresource/test/cases/finder_test.rb +0 -217
  171. data/lib/activeresource/test/cases/format_test.rb +0 -137
  172. data/lib/activeresource/test/cases/http_mock_test.rb +0 -213
  173. data/lib/activeresource/test/cases/inheritence_test.rb +0 -19
  174. data/lib/activeresource/test/cases/inheriting_hash_test.rb +0 -25
  175. data/lib/activeresource/test/cases/log_subscriber_test.rb +0 -64
  176. data/lib/activeresource/test/cases/reflection_test.rb +0 -65
  177. data/lib/activeresource/test/cases/validations_test.rb +0 -78
  178. data/lib/activeresource/test/fixtures/address.rb +0 -20
  179. data/lib/activeresource/test/fixtures/beast.rb +0 -16
  180. data/lib/activeresource/test/fixtures/comment.rb +0 -5
  181. data/lib/activeresource/test/fixtures/customer.rb +0 -5
  182. data/lib/activeresource/test/fixtures/fixtures.rbi +0 -46
  183. data/lib/activeresource/test/fixtures/inventory.rb +0 -14
  184. data/lib/activeresource/test/fixtures/person.rb +0 -15
  185. data/lib/activeresource/test/fixtures/pet.rb +0 -6
  186. data/lib/activeresource/test/fixtures/post.rb +0 -5
  187. data/lib/activeresource/test/fixtures/product.rb +0 -11
  188. data/lib/activeresource/test/fixtures/project.rb +0 -19
  189. data/lib/activeresource/test/fixtures/proxy.rb +0 -6
  190. data/lib/activeresource/test/fixtures/sound.rb +0 -11
  191. data/lib/activeresource/test/fixtures/street_address.rb +0 -6
  192. data/lib/activeresource/test/fixtures/subscription_plan.rb +0 -7
  193. data/lib/activeresource/test/fixtures/weather.rb +0 -21
  194. data/lib/activeresource/test/setter_trap.rb +0 -28
  195. data/lib/activeresource/test/singleton_test.rb +0 -138
  196. data/lib/activeresource/test/threadsafe_attributes_test.rb +0 -91
  197. data/sorbet/config +0 -6
  198. data/sorbet/rbi/annotations/.gitattributes +0 -1
  199. data/sorbet/rbi/annotations/activemodel.rbi +0 -89
  200. data/sorbet/rbi/annotations/activesupport.rbi +0 -457
  201. data/sorbet/rbi/annotations/minitest.rbi +0 -119
  202. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  203. data/sorbet/rbi/dsl/.gitattributes +0 -1
  204. data/sorbet/rbi/dsl/active_support/callbacks.rbi +0 -21
  205. data/sorbet/rbi/gems/.gitattributes +0 -1
  206. data/sorbet/rbi/gems/actioncable@8.0.1.rbi +0 -252
  207. data/sorbet/rbi/gems/actionmailbox@8.0.1.rbi +0 -9
  208. data/sorbet/rbi/gems/actionmailer@8.0.1.rbi +0 -9
  209. data/sorbet/rbi/gems/actionpack@8.0.1.rbi +0 -21111
  210. data/sorbet/rbi/gems/actiontext@8.0.1.rbi +0 -9
  211. data/sorbet/rbi/gems/actionview@8.0.1.rbi +0 -16409
  212. data/sorbet/rbi/gems/activejob@8.0.1.rbi +0 -90
  213. data/sorbet/rbi/gems/activemodel-serializers-xml@1.0.3.rbi +0 -166
  214. data/sorbet/rbi/gems/activemodel@8.0.1.rbi +0 -6865
  215. data/sorbet/rbi/gems/activerecord@8.0.1.rbi +0 -43277
  216. data/sorbet/rbi/gems/activestorage@8.0.1.rbi +0 -9
  217. data/sorbet/rbi/gems/activesupport@8.0.1.rbi +0 -21426
  218. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -585
  219. data/sorbet/rbi/gems/base64@0.2.0.rbi +0 -509
  220. data/sorbet/rbi/gems/benchmark@0.4.0.rbi +0 -618
  221. data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +0 -78
  222. data/sorbet/rbi/gems/builder@3.3.0.rbi +0 -9
  223. data/sorbet/rbi/gems/bump@0.10.0.rbi +0 -169
  224. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3607
  225. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3427
  226. data/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi +0 -11645
  227. data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +0 -9
  228. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -623
  229. data/sorbet/rbi/gems/date@3.4.1.rbi +0 -75
  230. data/sorbet/rbi/gems/diff-lcs@1.5.1.rbi +0 -1131
  231. data/sorbet/rbi/gems/docile@1.4.1.rbi +0 -377
  232. data/sorbet/rbi/gems/drb@2.2.1.rbi +0 -1347
  233. data/sorbet/rbi/gems/erubi@1.13.0.rbi +0 -150
  234. data/sorbet/rbi/gems/globalid@1.2.1.rbi +0 -9
  235. data/sorbet/rbi/gems/i18n@1.14.6.rbi +0 -2359
  236. data/sorbet/rbi/gems/io-console@0.8.0.rbi +0 -9
  237. data/sorbet/rbi/gems/json@2.9.0.rbi +0 -1944
  238. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14238
  239. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +0 -240
  240. data/sorbet/rbi/gems/logger@1.6.3.rbi +0 -940
  241. data/sorbet/rbi/gems/loofah@2.23.1.rbi +0 -1081
  242. data/sorbet/rbi/gems/mail@2.8.1.rbi +0 -9
  243. data/sorbet/rbi/gems/marcel@1.0.4.rbi +0 -9
  244. data/sorbet/rbi/gems/method_source@1.1.0.rbi +0 -304
  245. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +0 -9
  246. data/sorbet/rbi/gems/minitest@5.25.4.rbi +0 -1547
  247. data/sorbet/rbi/gems/mocha@2.7.1.rbi +0 -12
  248. data/sorbet/rbi/gems/msgpack@1.7.5.rbi +0 -320
  249. data/sorbet/rbi/gems/net-imap@0.5.2.rbi +0 -9
  250. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +0 -9
  251. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +0 -292
  252. data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +0 -9
  253. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -159
  254. data/sorbet/rbi/gems/nio4r@2.7.4.rbi +0 -9
  255. data/sorbet/rbi/gems/nokogiri@1.17.2.rbi +0 -8201
  256. data/sorbet/rbi/gems/parallel@1.26.3.rbi +0 -291
  257. data/sorbet/rbi/gems/parser@3.3.6.0.rbi +0 -5519
  258. data/sorbet/rbi/gems/prism@1.2.0.rbi +0 -39085
  259. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1151
  260. data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10076
  261. data/sorbet/rbi/gems/psych@5.2.1.rbi +0 -1785
  262. data/sorbet/rbi/gems/racc@1.8.1.rbi +0 -162
  263. data/sorbet/rbi/gems/rack-session@2.0.0.rbi +0 -727
  264. data/sorbet/rbi/gems/rack-test@2.1.0.rbi +0 -747
  265. data/sorbet/rbi/gems/rack@3.1.8.rbi +0 -4905
  266. data/sorbet/rbi/gems/rackup@2.2.1.rbi +0 -230
  267. data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +0 -758
  268. data/sorbet/rbi/gems/rails-html-sanitizer@1.6.2.rbi +0 -785
  269. data/sorbet/rbi/gems/rails@8.0.1.rbi +0 -9
  270. data/sorbet/rbi/gems/railties@8.0.1.rbi +0 -6347
  271. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -403
  272. data/sorbet/rbi/gems/rake@13.2.1.rbi +0 -3028
  273. data/sorbet/rbi/gems/rbi@0.2.1.rbi +0 -4535
  274. data/sorbet/rbi/gems/rdoc@6.9.1.rbi +0 -12593
  275. data/sorbet/rbi/gems/regexp_parser@2.9.3.rbi +0 -3772
  276. data/sorbet/rbi/gems/reline@0.6.0.rbi +0 -2454
  277. data/sorbet/rbi/gems/rexml@3.4.0.rbi +0 -4871
  278. data/sorbet/rbi/gems/rspec-core@3.13.2.rbi +0 -11284
  279. data/sorbet/rbi/gems/rspec-expectations@3.13.3.rbi +0 -8183
  280. data/sorbet/rbi/gems/rspec-mocks@3.13.2.rbi +0 -5341
  281. data/sorbet/rbi/gems/rspec-support@3.13.2.rbi +0 -1630
  282. data/sorbet/rbi/gems/rspec@3.13.0.rbi +0 -83
  283. data/sorbet/rbi/gems/rubocop-ast@1.37.0.rbi +0 -7713
  284. data/sorbet/rbi/gems/rubocop-md@1.2.4.rbi +0 -123
  285. data/sorbet/rbi/gems/rubocop-minitest@0.36.0.rbi +0 -2613
  286. data/sorbet/rbi/gems/rubocop-packaging@0.5.2.rbi +0 -388
  287. data/sorbet/rbi/gems/rubocop-performance@1.23.0.rbi +0 -9
  288. data/sorbet/rbi/gems/rubocop-rails@2.27.0.rbi +0 -9535
  289. data/sorbet/rbi/gems/rubocop@1.69.2.rbi +0 -59600
  290. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1318
  291. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +0 -9
  292. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +0 -78
  293. data/sorbet/rbi/gems/simplecov-html@0.13.1.rbi +0 -225
  294. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +0 -2149
  295. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +0 -9
  296. data/sorbet/rbi/gems/spoom@1.5.0.rbi +0 -4932
  297. data/sorbet/rbi/gems/sqlite3@2.3.1.rbi +0 -1824
  298. data/sorbet/rbi/gems/standard-custom@1.0.2.rbi +0 -9
  299. data/sorbet/rbi/gems/standard-performance@1.6.0.rbi +0 -9
  300. data/sorbet/rbi/gems/standard@1.43.0.rbi +0 -926
  301. data/sorbet/rbi/gems/stringio@3.1.2.rbi +0 -9
  302. data/sorbet/rbi/gems/tapioca@0.16.4.rbi +0 -3597
  303. data/sorbet/rbi/gems/thor@1.3.2.rbi +0 -4378
  304. data/sorbet/rbi/gems/timeout@0.4.2.rbi +0 -151
  305. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +0 -5918
  306. data/sorbet/rbi/gems/unicode-display_width@3.1.2.rbi +0 -130
  307. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +0 -251
  308. data/sorbet/rbi/gems/uri@1.0.2.rbi +0 -2377
  309. data/sorbet/rbi/gems/useragent@0.16.11.rbi +0 -9
  310. data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +0 -9
  311. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +0 -9
  312. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
  313. data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18504
  314. data/sorbet/rbi/gems/zeitwerk@2.7.1.rbi +0 -9
  315. data/sorbet/tapioca/config.yml +0 -13
  316. data/sorbet/tapioca/require.rb +0 -13
@@ -1,2377 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `uri` gem.
5
- # Please instead update this file by running `bin/tapioca gem uri`.
6
-
7
-
8
- # module URI
9
- #
10
- # source://uri//lib/uri/common.rb#852
11
- module Kernel
12
- private
13
-
14
- # Returns a \URI object derived from the given +uri+,
15
- # which may be a \URI string or an existing \URI object:
16
- #
17
- # # Returns a new URI.
18
- # uri = URI('http://github.com/ruby/ruby')
19
- # # => #<URI::HTTP http://github.com/ruby/ruby>
20
- # # Returns the given URI.
21
- # URI(uri)
22
- # # => #<URI::HTTP http://github.com/ruby/ruby>
23
- #
24
- # source://uri//lib/uri/common.rb#865
25
- def URI(uri); end
26
-
27
- class << self
28
- # Returns a \URI object derived from the given +uri+,
29
- # which may be a \URI string or an existing \URI object:
30
- #
31
- # # Returns a new URI.
32
- # uri = URI('http://github.com/ruby/ruby')
33
- # # => #<URI::HTTP http://github.com/ruby/ruby>
34
- # # Returns the given URI.
35
- # URI(uri)
36
- # # => #<URI::HTTP http://github.com/ruby/ruby>
37
- #
38
- # source://uri//lib/uri/common.rb#865
39
- def URI(uri); end
40
- end
41
- end
42
-
43
- # source://uri//lib/uri.rb#90
44
- module URI
45
- class << self
46
- # source://uri//lib/uri/common.rb#43
47
- def const_missing(const); end
48
-
49
- # Like URI.decode_www_form_component, except that <tt>'+'</tt> is preserved.
50
- #
51
- # source://uri//lib/uri/common.rb#402
52
- def decode_uri_component(str, enc = T.unsafe(nil)); end
53
-
54
- # Returns name/value pairs derived from the given string +str+,
55
- # which must be an ASCII string.
56
- #
57
- # The method may be used to decode the body of Net::HTTPResponse object +res+
58
- # for which <tt>res['Content-Type']</tt> is <tt>'application/x-www-form-urlencoded'</tt>.
59
- #
60
- # The returned data is an array of 2-element subarrays;
61
- # each subarray is a name/value pair (both are strings).
62
- # Each returned string has encoding +enc+,
63
- # and has had invalid characters removed via
64
- # {String#scrub}[https://docs.ruby-lang.org/en/master/String.html#method-i-scrub].
65
- #
66
- # A simple example:
67
- #
68
- # URI.decode_www_form('foo=0&bar=1&baz')
69
- # # => [["foo", "0"], ["bar", "1"], ["baz", ""]]
70
- #
71
- # The returned strings have certain conversions,
72
- # similar to those performed in URI.decode_www_form_component:
73
- #
74
- # URI.decode_www_form('f%23o=%2F&b-r=%24&b+z=%40')
75
- # # => [["f#o", "/"], ["b-r", "$"], ["b z", "@"]]
76
- #
77
- # The given string may contain consecutive separators:
78
- #
79
- # URI.decode_www_form('foo=0&&bar=1&&baz=2')
80
- # # => [["foo", "0"], ["", ""], ["bar", "1"], ["", ""], ["baz", "2"]]
81
- #
82
- # A different separator may be specified:
83
- #
84
- # URI.decode_www_form('foo=0--bar=1--baz', separator: '--')
85
- # # => [["foo", "0"], ["bar", "1"], ["baz", ""]]
86
- #
87
- # @raise [ArgumentError]
88
- #
89
- # source://uri//lib/uri/common.rb#577
90
- def decode_www_form(str, enc = T.unsafe(nil), separator: T.unsafe(nil), use__charset_: T.unsafe(nil), isindex: T.unsafe(nil)); end
91
-
92
- # Returns a string decoded from the given \URL-encoded string +str+.
93
- #
94
- # The given string is first encoded as Encoding::ASCII-8BIT (using String#b),
95
- # then decoded (as below), and finally force-encoded to the given encoding +enc+.
96
- #
97
- # The returned string:
98
- #
99
- # - Preserves:
100
- #
101
- # - Characters <tt>'*'</tt>, <tt>'.'</tt>, <tt>'-'</tt>, and <tt>'_'</tt>.
102
- # - Character in ranges <tt>'a'..'z'</tt>, <tt>'A'..'Z'</tt>,
103
- # and <tt>'0'..'9'</tt>.
104
- #
105
- # Example:
106
- #
107
- # URI.decode_www_form_component('*.-_azAZ09')
108
- # # => "*.-_azAZ09"
109
- #
110
- # - Converts:
111
- #
112
- # - Character <tt>'+'</tt> to character <tt>' '</tt>.
113
- # - Each "percent notation" to an ASCII character.
114
- #
115
- # Example:
116
- #
117
- # URI.decode_www_form_component('Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A')
118
- # # => "Here are some punctuation characters: ,;?:"
119
- #
120
- # Related: URI.decode_uri_component (preserves <tt>'+'</tt>).
121
- #
122
- # source://uri//lib/uri/common.rb#391
123
- def decode_www_form_component(str, enc = T.unsafe(nil)); end
124
-
125
- # Like URI.encode_www_form_component, except that <tt>' '</tt> (space)
126
- # is encoded as <tt>'%20'</tt> (instead of <tt>'+'</tt>).
127
- #
128
- # source://uri//lib/uri/common.rb#397
129
- def encode_uri_component(str, enc = T.unsafe(nil)); end
130
-
131
- # Returns a URL-encoded string derived from the given
132
- # {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html#module-Enumerable-label-Enumerable+in+Ruby+Classes]
133
- # +enum+.
134
- #
135
- # The result is suitable for use as form data
136
- # for an \HTTP request whose <tt>Content-Type</tt> is
137
- # <tt>'application/x-www-form-urlencoded'</tt>.
138
- #
139
- # The returned string consists of the elements of +enum+,
140
- # each converted to one or more URL-encoded strings,
141
- # and all joined with character <tt>'&'</tt>.
142
- #
143
- # Simple examples:
144
- #
145
- # URI.encode_www_form([['foo', 0], ['bar', 1], ['baz', 2]])
146
- # # => "foo=0&bar=1&baz=2"
147
- # URI.encode_www_form({foo: 0, bar: 1, baz: 2})
148
- # # => "foo=0&bar=1&baz=2"
149
- #
150
- # The returned string is formed using method URI.encode_www_form_component,
151
- # which converts certain characters:
152
- #
153
- # URI.encode_www_form('f#o': '/', 'b-r': '$', 'b z': '@')
154
- # # => "f%23o=%2F&b-r=%24&b+z=%40"
155
- #
156
- # When +enum+ is Array-like, each element +ele+ is converted to a field:
157
- #
158
- # - If +ele+ is an array of two or more elements,
159
- # the field is formed from its first two elements
160
- # (and any additional elements are ignored):
161
- #
162
- # name = URI.encode_www_form_component(ele[0], enc)
163
- # value = URI.encode_www_form_component(ele[1], enc)
164
- # "#{name}=#{value}"
165
- #
166
- # Examples:
167
- #
168
- # URI.encode_www_form([%w[foo bar], %w[baz bat bah]])
169
- # # => "foo=bar&baz=bat"
170
- # URI.encode_www_form([['foo', 0], ['bar', :baz, 'bat']])
171
- # # => "foo=0&bar=baz"
172
- #
173
- # - If +ele+ is an array of one element,
174
- # the field is formed from <tt>ele[0]</tt>:
175
- #
176
- # URI.encode_www_form_component(ele[0])
177
- #
178
- # Example:
179
- #
180
- # URI.encode_www_form([['foo'], [:bar], [0]])
181
- # # => "foo&bar&0"
182
- #
183
- # - Otherwise the field is formed from +ele+:
184
- #
185
- # URI.encode_www_form_component(ele)
186
- #
187
- # Example:
188
- #
189
- # URI.encode_www_form(['foo', :bar, 0])
190
- # # => "foo&bar&0"
191
- #
192
- # The elements of an Array-like +enum+ may be mixture:
193
- #
194
- # URI.encode_www_form([['foo', 0], ['bar', 1, 2], ['baz'], :bat])
195
- # # => "foo=0&bar=1&baz&bat"
196
- #
197
- # When +enum+ is Hash-like,
198
- # each +key+/+value+ pair is converted to one or more fields:
199
- #
200
- # - If +value+ is
201
- # {Array-convertible}[https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html#label-Array-Convertible+Objects],
202
- # each element +ele+ in +value+ is paired with +key+ to form a field:
203
- #
204
- # name = URI.encode_www_form_component(key, enc)
205
- # value = URI.encode_www_form_component(ele, enc)
206
- # "#{name}=#{value}"
207
- #
208
- # Example:
209
- #
210
- # URI.encode_www_form({foo: [:bar, 1], baz: [:bat, :bam, 2]})
211
- # # => "foo=bar&foo=1&baz=bat&baz=bam&baz=2"
212
- #
213
- # - Otherwise, +key+ and +value+ are paired to form a field:
214
- #
215
- # name = URI.encode_www_form_component(key, enc)
216
- # value = URI.encode_www_form_component(value, enc)
217
- # "#{name}=#{value}"
218
- #
219
- # Example:
220
- #
221
- # URI.encode_www_form({foo: 0, bar: 1, baz: 2})
222
- # # => "foo=0&bar=1&baz=2"
223
- #
224
- # The elements of a Hash-like +enum+ may be mixture:
225
- #
226
- # URI.encode_www_form({foo: [0, 1], bar: 2})
227
- # # => "foo=0&foo=1&bar=2"
228
- #
229
- # source://uri//lib/uri/common.rb#524
230
- def encode_www_form(enum, enc = T.unsafe(nil)); end
231
-
232
- # Returns a URL-encoded string derived from the given string +str+.
233
- #
234
- # The returned string:
235
- #
236
- # - Preserves:
237
- #
238
- # - Characters <tt>'*'</tt>, <tt>'.'</tt>, <tt>'-'</tt>, and <tt>'_'</tt>.
239
- # - Character in ranges <tt>'a'..'z'</tt>, <tt>'A'..'Z'</tt>,
240
- # and <tt>'0'..'9'</tt>.
241
- #
242
- # Example:
243
- #
244
- # URI.encode_www_form_component('*.-_azAZ09')
245
- # # => "*.-_azAZ09"
246
- #
247
- # - Converts:
248
- #
249
- # - Character <tt>' '</tt> to character <tt>'+'</tt>.
250
- # - Any other character to "percent notation";
251
- # the percent notation for character <i>c</i> is <tt>'%%%X' % c.ord</tt>.
252
- #
253
- # Example:
254
- #
255
- # URI.encode_www_form_component('Here are some punctuation characters: ,;?:')
256
- # # => "Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A"
257
- #
258
- # Encoding:
259
- #
260
- # - If +str+ has encoding Encoding::ASCII_8BIT, argument +enc+ is ignored.
261
- # - Otherwise +str+ is converted first to Encoding::UTF_8
262
- # (with suitable character replacements),
263
- # and then to encoding +enc+.
264
- #
265
- # In either case, the returned string has forced encoding Encoding::US_ASCII.
266
- #
267
- # Related: URI.encode_uri_component (encodes <tt>' '</tt> as <tt>'%20'</tt>).
268
- #
269
- # source://uri//lib/uri/common.rb#358
270
- def encode_www_form_component(str, enc = T.unsafe(nil)); end
271
-
272
- # == Synopsis
273
- #
274
- # URI::extract(str[, schemes][,&blk])
275
- #
276
- # == Args
277
- #
278
- # +str+::
279
- # String to extract URIs from.
280
- # +schemes+::
281
- # Limit URI matching to specific schemes.
282
- #
283
- # == Description
284
- #
285
- # Extracts URIs from a string. If block given, iterates through all matched URIs.
286
- # Returns nil if block given or array with matches.
287
- #
288
- # == Usage
289
- #
290
- # require "uri"
291
- #
292
- # URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.")
293
- # # => ["http://foo.example.com/bla", "mailto:test@example.com"]
294
- #
295
- # source://uri//lib/uri/common.rb#262
296
- def extract(str, schemes = T.unsafe(nil), &block); end
297
-
298
- # Returns a new object constructed from the given +scheme+, +arguments+,
299
- # and +default+:
300
- #
301
- # - The new object is an instance of <tt>URI.scheme_list[scheme.upcase]</tt>.
302
- # - The object is initialized by calling the class initializer
303
- # using +scheme+ and +arguments+.
304
- # See URI::Generic.new.
305
- #
306
- # Examples:
307
- #
308
- # values = ['john.doe', 'www.example.com', '123', nil, '/forum/questions/', nil, 'tag=networking&order=newest', 'top']
309
- # URI.for('https', *values)
310
- # # => #<URI::HTTPS https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
311
- # URI.for('foo', *values, default: URI::HTTP)
312
- # # => #<URI::HTTP foo://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
313
- #
314
- # source://uri//lib/uri/common.rb#146
315
- def for(scheme, *arguments, default: T.unsafe(nil)); end
316
-
317
- # return encoding or nil
318
- # http://encoding.spec.whatwg.org/#concept-encoding-get
319
- #
320
- # source://uri//lib/uri/common.rb#847
321
- def get_encoding(label); end
322
-
323
- # Merges the given URI strings +str+
324
- # per {RFC 2396}[https://www.rfc-editor.org/rfc/rfc2396.html].
325
- #
326
- # Each string in +str+ is converted to an
327
- # {RFC3986 URI}[https://www.rfc-editor.org/rfc/rfc3986.html] before being merged.
328
- #
329
- # Examples:
330
- #
331
- # URI.join("http://example.com/","main.rbx")
332
- # # => #<URI::HTTP http://example.com/main.rbx>
333
- #
334
- # URI.join('http://example.com', 'foo')
335
- # # => #<URI::HTTP http://example.com/foo>
336
- #
337
- # URI.join('http://example.com', '/foo', '/bar')
338
- # # => #<URI::HTTP http://example.com/bar>
339
- #
340
- # URI.join('http://example.com', '/foo', 'bar')
341
- # # => #<URI::HTTP http://example.com/bar>
342
- #
343
- # URI.join('http://example.com', '/foo/', 'bar')
344
- # # => #<URI::HTTP http://example.com/foo/bar>
345
- #
346
- # source://uri//lib/uri/common.rb#234
347
- def join(*str); end
348
-
349
- # Returns a new \URI object constructed from the given string +uri+:
350
- #
351
- # URI.parse('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
352
- # # => #<URI::HTTPS https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
353
- # URI.parse('http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
354
- # # => #<URI::HTTP http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
355
- #
356
- # It's recommended to first ::escape string +uri+
357
- # if it may contain invalid URI characters.
358
- #
359
- # source://uri//lib/uri/common.rb#207
360
- def parse(uri); end
361
-
362
- # source://uri//lib/uri/common.rb#25
363
- def parser=(parser = T.unsafe(nil)); end
364
-
365
- # == Synopsis
366
- #
367
- # URI::regexp([match_schemes])
368
- #
369
- # == Args
370
- #
371
- # +match_schemes+::
372
- # Array of schemes. If given, resulting regexp matches to URIs
373
- # whose scheme is one of the match_schemes.
374
- #
375
- # == Description
376
- #
377
- # Returns a Regexp object which matches to URI-like strings.
378
- # The Regexp object returned by this method includes arbitrary
379
- # number of capture group (parentheses). Never rely on its number.
380
- #
381
- # == Usage
382
- #
383
- # require 'uri'
384
- #
385
- # # extract first URI from html_string
386
- # html_string.slice(URI.regexp)
387
- #
388
- # # remove ftp URIs
389
- # html_string.sub(URI.regexp(['ftp']), '')
390
- #
391
- # # You should not rely on the number of parentheses
392
- # html_string.scan(URI.regexp) do |*matches|
393
- # p $&
394
- # end
395
- #
396
- # source://uri//lib/uri/common.rb#299
397
- def regexp(schemes = T.unsafe(nil)); end
398
-
399
- # Registers the given +klass+ as the class to be instantiated
400
- # when parsing a \URI with the given +scheme+:
401
- #
402
- # URI.register_scheme('MS_SEARCH', URI::Generic) # => URI::Generic
403
- # URI.scheme_list['MS_SEARCH'] # => URI::Generic
404
- #
405
- # Note that after calling String#upcase on +scheme+, it must be a valid
406
- # constant name.
407
- #
408
- # source://uri//lib/uri/common.rb#102
409
- def register_scheme(scheme, klass); end
410
-
411
- # Returns a hash of the defined schemes:
412
- #
413
- # URI.scheme_list
414
- # # =>
415
- # {"MAILTO"=>URI::MailTo,
416
- # "LDAPS"=>URI::LDAPS,
417
- # "WS"=>URI::WS,
418
- # "HTTP"=>URI::HTTP,
419
- # "HTTPS"=>URI::HTTPS,
420
- # "LDAP"=>URI::LDAP,
421
- # "FILE"=>URI::File,
422
- # "FTP"=>URI::FTP}
423
- #
424
- # Related: URI.register_scheme.
425
- #
426
- # source://uri//lib/uri/common.rb#120
427
- def scheme_list; end
428
-
429
- # Returns a 9-element array representing the parts of the \URI
430
- # formed from the string +uri+;
431
- # each array element is a string or +nil+:
432
- #
433
- # names = %w[scheme userinfo host port registry path opaque query fragment]
434
- # values = URI.split('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
435
- # names.zip(values)
436
- # # =>
437
- # [["scheme", "https"],
438
- # ["userinfo", "john.doe"],
439
- # ["host", "www.example.com"],
440
- # ["port", "123"],
441
- # ["registry", nil],
442
- # ["path", "/forum/questions/"],
443
- # ["opaque", nil],
444
- # ["query", "tag=networking&order=newest"],
445
- # ["fragment", "top"]]
446
- #
447
- # source://uri//lib/uri/common.rb#193
448
- def split(uri); end
449
-
450
- private
451
-
452
- # @raise [ArgumentError]
453
- #
454
- # source://uri//lib/uri/common.rb#420
455
- def _decode_uri_component(regexp, str, enc); end
456
-
457
- # source://uri//lib/uri/common.rb#406
458
- def _encode_uri_component(regexp, table, str, enc); end
459
- end
460
- end
461
-
462
- # FTP URI syntax is defined by RFC1738 section 3.2.
463
- #
464
- # This class will be redesigned because of difference of implementations;
465
- # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it
466
- # is a good summary about the de facto spec.
467
- # https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04
468
- #
469
- # source://uri//lib/uri/ftp.rb#22
470
- class URI::FTP < ::URI::Generic
471
- # == Description
472
- #
473
- # Creates a new URI::FTP object from generic URL components with no
474
- # syntax checking.
475
- #
476
- # Unlike build(), this method does not escape the path component as
477
- # required by RFC1738; instead it is treated as per RFC2396.
478
- #
479
- # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
480
- # +opaque+, +query+, and +fragment+, in that order.
481
- #
482
- # @raise [InvalidURIError]
483
- # @return [FTP] a new instance of FTP
484
- #
485
- # source://uri//lib/uri/ftp.rb#133
486
- def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = T.unsafe(nil), arg_check = T.unsafe(nil)); end
487
-
488
- # source://uri//lib/uri/ftp.rb#214
489
- def merge(oth); end
490
-
491
- # Returns the path from an FTP URI.
492
- #
493
- # RFC 1738 specifically states that the path for an FTP URI does not
494
- # include the / which separates the URI path from the URI host. Example:
495
- #
496
- # <code>ftp://ftp.example.com/pub/ruby</code>
497
- #
498
- # The above URI indicates that the client should connect to
499
- # ftp.example.com then cd to pub/ruby from the initial login directory.
500
- #
501
- # If you want to cd to an absolute directory, you must include an
502
- # escaped / (%2F) in the path. Example:
503
- #
504
- # <code>ftp://ftp.example.com/%2Fpub/ruby</code>
505
- #
506
- # This method will then return "/pub/ruby".
507
- #
508
- # source://uri//lib/uri/ftp.rb#240
509
- def path; end
510
-
511
- # Returns a String representation of the URI::FTP.
512
- #
513
- # source://uri//lib/uri/ftp.rb#251
514
- def to_s; end
515
-
516
- # typecode accessor.
517
- #
518
- # See URI::FTP::COMPONENT.
519
- #
520
- # source://uri//lib/uri/ftp.rb#161
521
- def typecode; end
522
-
523
- # == Args
524
- #
525
- # +v+::
526
- # String
527
- #
528
- # == Description
529
- #
530
- # Public setter for the typecode +v+
531
- # (with validation).
532
- #
533
- # See also URI::FTP.check_typecode.
534
- #
535
- # == Usage
536
- #
537
- # require 'uri'
538
- #
539
- # uri = URI.parse("ftp://john@ftp.example.com/my_file.img")
540
- # #=> #<URI::FTP ftp://john@ftp.example.com/my_file.img>
541
- # uri.typecode = "i"
542
- # uri
543
- # #=> #<URI::FTP ftp://john@ftp.example.com/my_file.img;type=i>
544
- #
545
- # source://uri//lib/uri/ftp.rb#208
546
- def typecode=(typecode); end
547
-
548
- protected
549
-
550
- # Private setter for the path of the URI::FTP.
551
- #
552
- # source://uri//lib/uri/ftp.rb#245
553
- def set_path(v); end
554
-
555
- # Private setter for the typecode +v+.
556
- #
557
- # See also URI::FTP.typecode=.
558
- #
559
- # source://uri//lib/uri/ftp.rb#180
560
- def set_typecode(v); end
561
-
562
- private
563
-
564
- # Validates typecode +v+,
565
- # returns +true+ or +false+.
566
- #
567
- # source://uri//lib/uri/ftp.rb#166
568
- def check_typecode(v); end
569
-
570
- class << self
571
- # == Description
572
- #
573
- # Creates a new URI::FTP object from components, with syntax checking.
574
- #
575
- # The components accepted are +userinfo+, +host+, +port+, +path+, and
576
- # +typecode+.
577
- #
578
- # The components should be provided either as an Array, or as a Hash
579
- # with keys formed by preceding the component names with a colon.
580
- #
581
- # If an Array is used, the components must be passed in the
582
- # order <code>[userinfo, host, port, path, typecode]</code>.
583
- #
584
- # If the path supplied is absolute, it will be escaped in order to
585
- # make it absolute in the URI.
586
- #
587
- # Examples:
588
- #
589
- # require 'uri'
590
- #
591
- # uri1 = URI::FTP.build(['user:password', 'ftp.example.com', nil,
592
- # '/path/file.zip', 'i'])
593
- # uri1.to_s # => "ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i"
594
- #
595
- # uri2 = URI::FTP.build({:host => 'ftp.example.com',
596
- # :path => 'ruby/src'})
597
- # uri2.to_s # => "ftp://ftp.example.com/ruby/src"
598
- #
599
- # source://uri//lib/uri/ftp.rb#96
600
- def build(args); end
601
-
602
- # source://uri//lib/uri/ftp.rb#47
603
- def new2(user, password, host, port, path, typecode = T.unsafe(nil), arg_check = T.unsafe(nil)); end
604
- end
605
- end
606
-
607
- # The "file" URI is defined by RFC8089.
608
- #
609
- # source://uri//lib/uri/file.rb#10
610
- class URI::File < ::URI::Generic
611
- # raise InvalidURIError
612
- #
613
- # @raise [URI::InvalidURIError]
614
- #
615
- # source://uri//lib/uri/file.rb#82
616
- def check_password(user); end
617
-
618
- # raise InvalidURIError
619
- #
620
- # @raise [URI::InvalidURIError]
621
- #
622
- # source://uri//lib/uri/file.rb#77
623
- def check_user(user); end
624
-
625
- # raise InvalidURIError
626
- #
627
- # @raise [URI::InvalidURIError]
628
- #
629
- # source://uri//lib/uri/file.rb#72
630
- def check_userinfo(user); end
631
-
632
- # Protected setter for the host component +v+.
633
- #
634
- # See also URI::Generic.host=.
635
- #
636
- # source://uri//lib/uri/file.rb#62
637
- def set_host(v); end
638
-
639
- # do nothing
640
- #
641
- # source://uri//lib/uri/file.rb#95
642
- def set_password(v); end
643
-
644
- # do nothing
645
- #
646
- # source://uri//lib/uri/file.rb#68
647
- def set_port(v); end
648
-
649
- # do nothing
650
- #
651
- # source://uri//lib/uri/file.rb#91
652
- def set_user(v); end
653
-
654
- # do nothing
655
- #
656
- # source://uri//lib/uri/file.rb#87
657
- def set_userinfo(v); end
658
-
659
- class << self
660
- # == Description
661
- #
662
- # Creates a new URI::File object from components, with syntax checking.
663
- #
664
- # The components accepted are +host+ and +path+.
665
- #
666
- # The components should be provided either as an Array, or as a Hash
667
- # with keys formed by preceding the component names with a colon.
668
- #
669
- # If an Array is used, the components must be passed in the
670
- # order <code>[host, path]</code>.
671
- #
672
- # A path from e.g. the File class should be escaped before
673
- # being passed.
674
- #
675
- # Examples:
676
- #
677
- # require 'uri'
678
- #
679
- # uri1 = URI::File.build(['host.example.com', '/path/file.zip'])
680
- # uri1.to_s # => "file://host.example.com/path/file.zip"
681
- #
682
- # uri2 = URI::File.build({:host => 'host.example.com',
683
- # :path => '/ruby/src'})
684
- # uri2.to_s # => "file://host.example.com/ruby/src"
685
- #
686
- # uri3 = URI::File.build({:path => URI::escape('/path/my file.txt')})
687
- # uri3.to_s # => "file:///path/my%20file.txt"
688
- #
689
- # source://uri//lib/uri/file.rb#53
690
- def build(args); end
691
- end
692
- end
693
-
694
- # An Array of the available components for URI::File.
695
- #
696
- # source://uri//lib/uri/file.rb#17
697
- URI::File::COMPONENT = T.let(T.unsafe(nil), Array)
698
-
699
- # A Default port of nil for URI::File.
700
- #
701
- # source://uri//lib/uri/file.rb#12
702
- URI::File::DEFAULT_PORT = T.let(T.unsafe(nil), T.untyped)
703
-
704
- # Base class for all URI classes.
705
- # Implements generic URI syntax as per RFC 2396.
706
- #
707
- # source://uri//lib/uri/generic.rb#21
708
- class URI::Generic
709
- include ::URI
710
-
711
- # == Args
712
- #
713
- # +scheme+::
714
- # Protocol scheme, i.e. 'http','ftp','mailto' and so on.
715
- # +userinfo+::
716
- # User name and password, i.e. 'sdmitry:bla'.
717
- # +host+::
718
- # Server host name.
719
- # +port+::
720
- # Server port.
721
- # +registry+::
722
- # Registry of naming authorities.
723
- # +path+::
724
- # Path on server.
725
- # +opaque+::
726
- # Opaque part.
727
- # +query+::
728
- # Query data.
729
- # +fragment+::
730
- # Part of the URI after '#' character.
731
- # +parser+::
732
- # Parser for internal use [URI::DEFAULT_PARSER by default].
733
- # +arg_check+::
734
- # Check arguments [false by default].
735
- #
736
- # == Description
737
- #
738
- # Creates a new URI::Generic instance from ``generic'' components without check.
739
- #
740
- # @return [Generic] a new instance of Generic
741
- #
742
- # source://uri//lib/uri/generic.rb#169
743
- def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = T.unsafe(nil), arg_check = T.unsafe(nil)); end
744
-
745
- # == Args
746
- #
747
- # +oth+::
748
- # URI or String
749
- #
750
- # == Description
751
- #
752
- # Merges two URIs.
753
- #
754
- # == Usage
755
- #
756
- # require 'uri'
757
- #
758
- # uri = URI.parse("http://my.example.com")
759
- # uri.merge("/main.rbx?page=1")
760
- # # => "http://my.example.com/main.rbx?page=1"
761
- # merge
762
- #
763
- # source://uri//lib/uri/generic.rb#1109
764
- def +(oth); end
765
-
766
- # == Args
767
- #
768
- # +oth+::
769
- # URI or String
770
- #
771
- # == Description
772
- #
773
- # Calculates relative path from oth to self.
774
- #
775
- # == Usage
776
- #
777
- # require 'uri'
778
- #
779
- # uri = URI.parse('http://my.example.com/main.rbx?page=1')
780
- # uri.route_from('http://my.example.com')
781
- # #=> #<URI::Generic /main.rbx?page=1>
782
- #
783
- # source://uri//lib/uri/generic.rb#1262
784
- def -(oth); end
785
-
786
- # Compares two URIs.
787
- #
788
- # source://uri//lib/uri/generic.rb#1387
789
- def ==(oth); end
790
-
791
- # Returns true if URI has a scheme (e.g. http:// or https://) specified.
792
- #
793
- # @return [Boolean]
794
- #
795
- # source://uri//lib/uri/generic.rb#972
796
- def absolute; end
797
-
798
- # Returns true if URI has a scheme (e.g. http:// or https://) specified.
799
- #
800
- # @return [Boolean]
801
- #
802
- # source://uri//lib/uri/generic.rb#972
803
- def absolute?; end
804
-
805
- # == Args
806
- #
807
- # +v+::
808
- # URI or String
809
- #
810
- # == Description
811
- #
812
- # Attempts to parse other URI +oth+,
813
- # returns [parsed_oth, self].
814
- #
815
- # == Usage
816
- #
817
- # require 'uri'
818
- #
819
- # uri = URI.parse("http://my.example.com")
820
- # uri.coerce("http://foo.com")
821
- # #=> [#<URI::HTTP http://foo.com>, #<URI::HTTP http://my.example.com>]
822
- #
823
- # source://uri//lib/uri/generic.rb#1464
824
- def coerce(oth); end
825
-
826
- # Components of the URI in the order.
827
- #
828
- # source://uri//lib/uri/generic.rb#313
829
- def component; end
830
-
831
- # Returns the password component after URI decoding.
832
- #
833
- # source://uri//lib/uri/generic.rb#583
834
- def decoded_password; end
835
-
836
- # Returns the user component after URI decoding.
837
- #
838
- # source://uri//lib/uri/generic.rb#578
839
- def decoded_user; end
840
-
841
- # Returns default port.
842
- #
843
- # source://uri//lib/uri/generic.rb#39
844
- def default_port; end
845
-
846
- # @return [Boolean]
847
- #
848
- # source://uri//lib/uri/generic.rb#1399
849
- def eql?(oth); end
850
-
851
- # Returns a proxy URI.
852
- # The proxy URI is obtained from environment variables such as http_proxy,
853
- # ftp_proxy, no_proxy, etc.
854
- # If there is no proper proxy, nil is returned.
855
- #
856
- # If the optional parameter +env+ is specified, it is used instead of ENV.
857
- #
858
- # Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.)
859
- # are examined, too.
860
- #
861
- # But http_proxy and HTTP_PROXY is treated specially under CGI environment.
862
- # It's because HTTP_PROXY may be set by Proxy: header.
863
- # So HTTP_PROXY is not used.
864
- # http_proxy is not used too if the variable is case insensitive.
865
- # CGI_HTTP_PROXY can be used instead.
866
- #
867
- # @raise [BadURIError]
868
- #
869
- # source://uri//lib/uri/generic.rb#1490
870
- def find_proxy(env = T.unsafe(nil)); end
871
-
872
- # Returns the fragment component of the URI.
873
- #
874
- # URI("http://foo/bar/baz?search=FooBar#ponies").fragment #=> "ponies"
875
- #
876
- # source://uri//lib/uri/generic.rb#283
877
- def fragment; end
878
-
879
- # Checks the fragment +v+ component against the URI::Parser Regexp for :FRAGMENT.
880
- #
881
- #
882
- # == Args
883
- #
884
- # +v+::
885
- # String
886
- #
887
- # == Description
888
- #
889
- # Public setter for the fragment component +v+
890
- # (with validation).
891
- #
892
- # == Usage
893
- #
894
- # require 'uri'
895
- #
896
- # uri = URI.parse("http://my.example.com/?id=25#time=1305212049")
897
- # uri.fragment = "time=1305212086"
898
- # uri.to_s #=> "http://my.example.com/?id=25#time=1305212086"
899
- #
900
- # source://uri//lib/uri/generic.rb#929
901
- def fragment=(v); end
902
-
903
- # source://uri//lib/uri/generic.rb#1395
904
- def hash; end
905
-
906
- # Returns true if URI is hierarchical.
907
- #
908
- # == Description
909
- #
910
- # URI has components listed in order of decreasing significance from left to right,
911
- # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3.
912
- #
913
- # == Usage
914
- #
915
- # require 'uri'
916
- #
917
- # uri = URI.parse("http://my.example.com/")
918
- # uri.hierarchical?
919
- # #=> true
920
- # uri = URI.parse("mailto:joe@example.com")
921
- # uri.hierarchical?
922
- # #=> false
923
- #
924
- # @return [Boolean]
925
- #
926
- # source://uri//lib/uri/generic.rb#961
927
- def hierarchical?; end
928
-
929
- # Returns the host component of the URI.
930
- #
931
- # URI("http://foo/bar/baz").host #=> "foo"
932
- #
933
- # It returns nil if no host component exists.
934
- #
935
- # URI("mailto:foo@example.org").host #=> nil
936
- #
937
- # The component does not contain the port number.
938
- #
939
- # URI("http://foo:8080/bar/baz").host #=> "foo"
940
- #
941
- # Since IPv6 addresses are wrapped with brackets in URIs,
942
- # this method returns IPv6 addresses wrapped with brackets.
943
- # This form is not appropriate to pass to socket methods such as TCPSocket.open.
944
- # If unwrapped host names are required, use the #hostname method.
945
- #
946
- # URI("http://[::1]/bar/baz").host #=> "[::1]"
947
- # URI("http://[::1]/bar/baz").hostname #=> "::1"
948
- #
949
- # source://uri//lib/uri/generic.rb#243
950
- def host; end
951
-
952
- # == Args
953
- #
954
- # +v+::
955
- # String
956
- #
957
- # == Description
958
- #
959
- # Public setter for the host component +v+
960
- # (with validation).
961
- #
962
- # See also URI::Generic.check_host.
963
- #
964
- # == Usage
965
- #
966
- # require 'uri'
967
- #
968
- # uri = URI.parse("http://my.example.com")
969
- # uri.host = "foo.com"
970
- # uri.to_s #=> "http://foo.com"
971
- #
972
- # source://uri//lib/uri/generic.rb#639
973
- def host=(v); end
974
-
975
- # Extract the host part of the URI and unwrap brackets for IPv6 addresses.
976
- #
977
- # This method is the same as URI::Generic#host except
978
- # brackets for IPv6 (and future IP) addresses are removed.
979
- #
980
- # uri = URI("http://[::1]/bar")
981
- # uri.hostname #=> "::1"
982
- # uri.host #=> "[::1]"
983
- #
984
- # source://uri//lib/uri/generic.rb#654
985
- def hostname; end
986
-
987
- # Sets the host part of the URI as the argument with brackets for IPv6 addresses.
988
- #
989
- # This method is the same as URI::Generic#host= except
990
- # the argument can be a bare IPv6 address.
991
- #
992
- # uri = URI("http://foo/bar")
993
- # uri.hostname = "::1"
994
- # uri.to_s #=> "http://[::1]/bar"
995
- #
996
- # If the argument seems to be an IPv6 address,
997
- # it is wrapped with brackets.
998
- #
999
- # source://uri//lib/uri/generic.rb#671
1000
- def hostname=(v); end
1001
-
1002
- # source://uri//lib/uri/generic.rb#1441
1003
- def inspect; end
1004
-
1005
- # == Args
1006
- #
1007
- # +oth+::
1008
- # URI or String
1009
- #
1010
- # == Description
1011
- #
1012
- # Merges two URIs.
1013
- #
1014
- # == Usage
1015
- #
1016
- # require 'uri'
1017
- #
1018
- # uri = URI.parse("http://my.example.com")
1019
- # uri.merge("/main.rbx?page=1")
1020
- # # => "http://my.example.com/main.rbx?page=1"
1021
- #
1022
- # source://uri//lib/uri/generic.rb#1109
1023
- def merge(oth); end
1024
-
1025
- # == Args
1026
- #
1027
- # +oth+::
1028
- # URI or String
1029
- #
1030
- # == Description
1031
- #
1032
- # Destructive form of #merge.
1033
- #
1034
- # == Usage
1035
- #
1036
- # require 'uri'
1037
- #
1038
- # uri = URI.parse("http://my.example.com")
1039
- # uri.merge!("/main.rbx?page=1")
1040
- # uri.to_s # => "http://my.example.com/main.rbx?page=1"
1041
- #
1042
- # source://uri//lib/uri/generic.rb#1081
1043
- def merge!(oth); end
1044
-
1045
- # Returns normalized URI.
1046
- #
1047
- # require 'uri'
1048
- #
1049
- # URI("HTTP://my.EXAMPLE.com").normalize
1050
- # #=> #<URI::HTTP http://my.example.com/>
1051
- #
1052
- # Normalization here means:
1053
- #
1054
- # * scheme and host are converted to lowercase,
1055
- # * an empty path component is set to "/".
1056
- #
1057
- # source://uri//lib/uri/generic.rb#1319
1058
- def normalize; end
1059
-
1060
- # Destructive version of #normalize.
1061
- #
1062
- # source://uri//lib/uri/generic.rb#1328
1063
- def normalize!; end
1064
-
1065
- # Returns the opaque part of the URI.
1066
- #
1067
- # URI("mailto:foo@example.org").opaque #=> "foo@example.org"
1068
- # URI("http://foo/bar/baz").opaque #=> nil
1069
- #
1070
- # The portion of the path that does not make use of the slash '/'.
1071
- # The path typically refers to an absolute path or an opaque part.
1072
- # (See RFC2396 Section 3 and 5.2.)
1073
- #
1074
- # source://uri//lib/uri/generic.rb#277
1075
- def opaque; end
1076
-
1077
- # == Args
1078
- #
1079
- # +v+::
1080
- # String
1081
- #
1082
- # == Description
1083
- #
1084
- # Public setter for the opaque component +v+
1085
- # (with validation).
1086
- #
1087
- # See also URI::Generic.check_opaque.
1088
- #
1089
- # source://uri//lib/uri/generic.rb#901
1090
- def opaque=(v); end
1091
-
1092
- # Returns the parser to be used.
1093
- #
1094
- # Unless a URI::Parser is defined, DEFAULT_PARSER is used.
1095
- #
1096
- # source://uri//lib/uri/generic.rb#289
1097
- def parser; end
1098
-
1099
- # Returns the password component (without URI decoding).
1100
- #
1101
- # source://uri//lib/uri/generic.rb#573
1102
- def password; end
1103
-
1104
- # == Args
1105
- #
1106
- # +v+::
1107
- # String
1108
- #
1109
- # == Description
1110
- #
1111
- # Public setter for the +password+ component
1112
- # (with validation).
1113
- #
1114
- # See also URI::Generic.check_password.
1115
- #
1116
- # == Usage
1117
- #
1118
- # require 'uri'
1119
- #
1120
- # uri = URI.parse("http://john:S3nsit1ve@my.example.com")
1121
- # uri.password = "V3ry_S3nsit1ve"
1122
- # uri.to_s #=> "http://john:V3ry_S3nsit1ve@my.example.com"
1123
- #
1124
- # source://uri//lib/uri/generic.rb#498
1125
- def password=(password); end
1126
-
1127
- # Returns the path component of the URI.
1128
- #
1129
- # URI("http://foo/bar/baz").path #=> "/bar/baz"
1130
- #
1131
- # source://uri//lib/uri/generic.rb#260
1132
- def path; end
1133
-
1134
- # == Args
1135
- #
1136
- # +v+::
1137
- # String
1138
- #
1139
- # == Description
1140
- #
1141
- # Public setter for the path component +v+
1142
- # (with validation).
1143
- #
1144
- # See also URI::Generic.check_path.
1145
- #
1146
- # == Usage
1147
- #
1148
- # require 'uri'
1149
- #
1150
- # uri = URI.parse("http://my.example.com/pub/files")
1151
- # uri.path = "/faq/"
1152
- # uri.to_s #=> "http://my.example.com/faq/"
1153
- #
1154
- # source://uri//lib/uri/generic.rb#815
1155
- def path=(v); end
1156
-
1157
- # Returns the port component of the URI.
1158
- #
1159
- # URI("http://foo/bar/baz").port #=> 80
1160
- # URI("http://foo:8080/bar/baz").port #=> 8080
1161
- #
1162
- # source://uri//lib/uri/generic.rb#250
1163
- def port; end
1164
-
1165
- # == Args
1166
- #
1167
- # +v+::
1168
- # String
1169
- #
1170
- # == Description
1171
- #
1172
- # Public setter for the port component +v+
1173
- # (with validation).
1174
- #
1175
- # See also URI::Generic.check_port.
1176
- #
1177
- # == Usage
1178
- #
1179
- # require 'uri'
1180
- #
1181
- # uri = URI.parse("http://my.example.com")
1182
- # uri.port = 8080
1183
- # uri.to_s #=> "http://my.example.com:8080"
1184
- #
1185
- # source://uri//lib/uri/generic.rb#729
1186
- def port=(v); end
1187
-
1188
- # Returns the query component of the URI.
1189
- #
1190
- # URI("http://foo/bar/baz?search=FooBar").query #=> "search=FooBar"
1191
- #
1192
- # source://uri//lib/uri/generic.rb#266
1193
- def query; end
1194
-
1195
- # == Args
1196
- #
1197
- # +v+::
1198
- # String
1199
- #
1200
- # == Description
1201
- #
1202
- # Public setter for the query component +v+.
1203
- #
1204
- # == Usage
1205
- #
1206
- # require 'uri'
1207
- #
1208
- # uri = URI.parse("http://my.example.com/?id=25")
1209
- # uri.query = "id=1"
1210
- # uri.to_s #=> "http://my.example.com/?id=1"
1211
- #
1212
- # @raise [InvalidURIError]
1213
- #
1214
- # source://uri//lib/uri/generic.rb#839
1215
- def query=(v); end
1216
-
1217
- # source://uri//lib/uri/generic.rb#252
1218
- def registry; end
1219
-
1220
- # @raise [InvalidURIError]
1221
- #
1222
- # source://uri//lib/uri/generic.rb#745
1223
- def registry=(v); end
1224
-
1225
- # Returns true if URI does not have a scheme (e.g. http:// or https://) specified.
1226
- #
1227
- # @return [Boolean]
1228
- #
1229
- # source://uri//lib/uri/generic.rb#984
1230
- def relative?; end
1231
-
1232
- # == Args
1233
- #
1234
- # +oth+::
1235
- # URI or String
1236
- #
1237
- # == Description
1238
- #
1239
- # Calculates relative path from oth to self.
1240
- #
1241
- # == Usage
1242
- #
1243
- # require 'uri'
1244
- #
1245
- # uri = URI.parse('http://my.example.com/main.rbx?page=1')
1246
- # uri.route_from('http://my.example.com')
1247
- # #=> #<URI::Generic /main.rbx?page=1>
1248
- #
1249
- # source://uri//lib/uri/generic.rb#1262
1250
- def route_from(oth); end
1251
-
1252
- # == Args
1253
- #
1254
- # +oth+::
1255
- # URI or String
1256
- #
1257
- # == Description
1258
- #
1259
- # Calculates relative path to oth from self.
1260
- #
1261
- # == Usage
1262
- #
1263
- # require 'uri'
1264
- #
1265
- # uri = URI.parse('http://my.example.com')
1266
- # uri.route_to('http://my.example.com/main.rbx?page=1')
1267
- # #=> #<URI::Generic /main.rbx?page=1>
1268
- #
1269
- # source://uri//lib/uri/generic.rb#1302
1270
- def route_to(oth); end
1271
-
1272
- # Returns the scheme component of the URI.
1273
- #
1274
- # URI("http://foo/bar/baz").scheme #=> "http"
1275
- #
1276
- # source://uri//lib/uri/generic.rb#221
1277
- def scheme; end
1278
-
1279
- # == Args
1280
- #
1281
- # +v+::
1282
- # String
1283
- #
1284
- # == Description
1285
- #
1286
- # Public setter for the scheme component +v+
1287
- # (with validation).
1288
- #
1289
- # See also URI::Generic.check_scheme.
1290
- #
1291
- # == Usage
1292
- #
1293
- # require 'uri'
1294
- #
1295
- # uri = URI.parse("http://my.example.com")
1296
- # uri.scheme = "https"
1297
- # uri.to_s #=> "https://my.example.com"
1298
- #
1299
- # source://uri//lib/uri/generic.rb#360
1300
- def scheme=(v); end
1301
-
1302
- # == Args
1303
- #
1304
- # +components+::
1305
- # Multiple Symbol arguments defined in URI::HTTP.
1306
- #
1307
- # == Description
1308
- #
1309
- # Selects specified components from URI.
1310
- #
1311
- # == Usage
1312
- #
1313
- # require 'uri'
1314
- #
1315
- # uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx')
1316
- # uri.select(:userinfo, :host, :path)
1317
- # # => ["myuser:mypass", "my.example.com", "/test.rbx"]
1318
- #
1319
- # source://uri//lib/uri/generic.rb#1430
1320
- def select(*components); end
1321
-
1322
- # Constructs String from URI.
1323
- #
1324
- # source://uri//lib/uri/generic.rb#1343
1325
- def to_s; end
1326
-
1327
- # Constructs String from URI.
1328
- #
1329
- # source://uri//lib/uri/generic.rb#1343
1330
- def to_str; end
1331
-
1332
- # Returns the user component (without URI decoding).
1333
- #
1334
- # source://uri//lib/uri/generic.rb#568
1335
- def user; end
1336
-
1337
- # == Args
1338
- #
1339
- # +v+::
1340
- # String
1341
- #
1342
- # == Description
1343
- #
1344
- # Public setter for the +user+ component
1345
- # (with validation).
1346
- #
1347
- # See also URI::Generic.check_user.
1348
- #
1349
- # == Usage
1350
- #
1351
- # require 'uri'
1352
- #
1353
- # uri = URI.parse("http://john:S3nsit1ve@my.example.com")
1354
- # uri.user = "sam"
1355
- # uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com"
1356
- #
1357
- # source://uri//lib/uri/generic.rb#471
1358
- def user=(user); end
1359
-
1360
- # Returns the userinfo, either as 'user' or 'user:password'.
1361
- #
1362
- # source://uri//lib/uri/generic.rb#557
1363
- def userinfo; end
1364
-
1365
- # Sets userinfo, argument is string like 'name:pass'.
1366
- #
1367
- # source://uri//lib/uri/generic.rb#441
1368
- def userinfo=(userinfo); end
1369
-
1370
- protected
1371
-
1372
- # Returns an Array of the components defined from the COMPONENT Array.
1373
- #
1374
- # source://uri//lib/uri/generic.rb#1406
1375
- def component_ary; end
1376
-
1377
- # Protected setter for the host component +v+.
1378
- #
1379
- # See also URI::Generic.host=.
1380
- #
1381
- # source://uri//lib/uri/generic.rb#613
1382
- def set_host(v); end
1383
-
1384
- # Protected setter for the opaque component +v+.
1385
- #
1386
- # See also URI::Generic.opaque=.
1387
- #
1388
- # source://uri//lib/uri/generic.rb#883
1389
- def set_opaque(v); end
1390
-
1391
- # Protected setter for the password component +v+.
1392
- #
1393
- # See also URI::Generic.password=.
1394
- #
1395
- # source://uri//lib/uri/generic.rb#534
1396
- def set_password(v); end
1397
-
1398
- # Protected setter for the path component +v+.
1399
- #
1400
- # See also URI::Generic.path=.
1401
- #
1402
- # source://uri//lib/uri/generic.rb#789
1403
- def set_path(v); end
1404
-
1405
- # Protected setter for the port component +v+.
1406
- #
1407
- # See also URI::Generic.port=.
1408
- #
1409
- # source://uri//lib/uri/generic.rb#702
1410
- def set_port(v); end
1411
-
1412
- # @raise [InvalidURIError]
1413
- #
1414
- # source://uri//lib/uri/generic.rb#740
1415
- def set_registry(v); end
1416
-
1417
- # Protected setter for the scheme component +v+.
1418
- #
1419
- # See also URI::Generic.scheme=.
1420
- #
1421
- # source://uri//lib/uri/generic.rb#334
1422
- def set_scheme(v); end
1423
-
1424
- # Protected setter for the user component +v+.
1425
- #
1426
- # See also URI::Generic.user=.
1427
- #
1428
- # source://uri//lib/uri/generic.rb#524
1429
- def set_user(v); end
1430
-
1431
- # Protected setter for the +user+ component, and +password+ if available
1432
- # (with validation).
1433
- #
1434
- # See also URI::Generic.userinfo=.
1435
- #
1436
- # source://uri//lib/uri/generic.rb#509
1437
- def set_userinfo(user, password = T.unsafe(nil)); end
1438
-
1439
- private
1440
-
1441
- # Checks the host +v+ component for RFC2396 compliance
1442
- # and against the URI::Parser Regexp for :HOST.
1443
- #
1444
- # Can not have a registry or opaque component defined,
1445
- # with a host component defined.
1446
- #
1447
- # source://uri//lib/uri/generic.rb#594
1448
- def check_host(v); end
1449
-
1450
- # Checks the opaque +v+ component for RFC2396 compliance and
1451
- # against the URI::Parser Regexp for :OPAQUE.
1452
- #
1453
- # Can not have a host, port, user, or path component defined,
1454
- # with an opaque component defined.
1455
- #
1456
- # source://uri//lib/uri/generic.rb#861
1457
- def check_opaque(v); end
1458
-
1459
- # Checks the password +v+ component for RFC2396 compliance
1460
- # and against the URI::Parser Regexp for :USERINFO.
1461
- #
1462
- # Can not have a registry or opaque component defined,
1463
- # with a user component defined.
1464
- #
1465
- # source://uri//lib/uri/generic.rb#417
1466
- def check_password(v, user = T.unsafe(nil)); end
1467
-
1468
- # Checks the path +v+ component for RFC2396 compliance
1469
- # and against the URI::Parser Regexp
1470
- # for :ABS_PATH and :REL_PATH.
1471
- #
1472
- # Can not have a opaque component defined,
1473
- # with a path component defined.
1474
- #
1475
- # source://uri//lib/uri/generic.rb#757
1476
- def check_path(v); end
1477
-
1478
- # Checks the port +v+ component for RFC2396 compliance
1479
- # and against the URI::Parser Regexp for :PORT.
1480
- #
1481
- # Can not have a registry or opaque component defined,
1482
- # with a port component defined.
1483
- #
1484
- # source://uri//lib/uri/generic.rb#683
1485
- def check_port(v); end
1486
-
1487
- # @raise [InvalidURIError]
1488
- #
1489
- # source://uri//lib/uri/generic.rb#735
1490
- def check_registry(v); end
1491
-
1492
- # Checks the scheme +v+ component against the URI::Parser Regexp for :SCHEME.
1493
- #
1494
- # source://uri//lib/uri/generic.rb#320
1495
- def check_scheme(v); end
1496
-
1497
- # Checks the user +v+ component for RFC2396 compliance
1498
- # and against the URI::Parser Regexp for :USERINFO.
1499
- #
1500
- # Can not have a registry or opaque component defined,
1501
- # with a user component defined.
1502
- #
1503
- # source://uri//lib/uri/generic.rb#393
1504
- def check_user(v); end
1505
-
1506
- # Checks the +user+ and +password+.
1507
- #
1508
- # If +password+ is not provided, then +user+ is
1509
- # split, using URI::Generic.split_userinfo, to
1510
- # pull +user+ and +password.
1511
- #
1512
- # See also URI::Generic.check_user, URI::Generic.check_password.
1513
- #
1514
- # source://uri//lib/uri/generic.rb#375
1515
- def check_userinfo(user, password = T.unsafe(nil)); end
1516
-
1517
- # Escapes 'user:password' +v+ based on RFC 1738 section 3.1.
1518
- #
1519
- # source://uri//lib/uri/generic.rb#551
1520
- def escape_userpass(v); end
1521
-
1522
- # Merges a base path +base+, with relative path +rel+,
1523
- # returns a modified base path.
1524
- #
1525
- # source://uri//lib/uri/generic.rb#1000
1526
- def merge_path(base, rel); end
1527
-
1528
- # Replaces self by other URI object.
1529
- #
1530
- # source://uri//lib/uri/generic.rb#299
1531
- def replace!(oth); end
1532
-
1533
- # :stopdoc:
1534
- #
1535
- # source://uri//lib/uri/generic.rb#1194
1536
- def route_from0(oth); end
1537
-
1538
- # :stopdoc:
1539
- #
1540
- # source://uri//lib/uri/generic.rb#1155
1541
- def route_from_path(src, dst); end
1542
-
1543
- # Returns an Array of the path split on '/'.
1544
- #
1545
- # source://uri//lib/uri/generic.rb#991
1546
- def split_path(path); end
1547
-
1548
- # Returns the userinfo +ui+ as <code>[user, password]</code>
1549
- # if properly formatted as 'user:password'.
1550
- #
1551
- # source://uri//lib/uri/generic.rb#542
1552
- def split_userinfo(ui); end
1553
-
1554
- class << self
1555
- # == Synopsis
1556
- #
1557
- # See ::new.
1558
- #
1559
- # == Description
1560
- #
1561
- # Creates a new URI::Generic instance from components of URI::Generic
1562
- # with check. Components are: scheme, userinfo, host, port, registry, path,
1563
- # opaque, query, and fragment. You can provide arguments either by an Array or a Hash.
1564
- # See ::new for hash keys to use or for order of array items.
1565
- #
1566
- # source://uri//lib/uri/generic.rb#116
1567
- def build(args); end
1568
-
1569
- # == Synopsis
1570
- #
1571
- # See ::new.
1572
- #
1573
- # == Description
1574
- #
1575
- # At first, tries to create a new URI::Generic instance using
1576
- # URI::Generic::build. But, if exception URI::InvalidComponentError is raised,
1577
- # then it does URI::Escape.escape all URI components and tries again.
1578
- #
1579
- # source://uri//lib/uri/generic.rb#78
1580
- def build2(args); end
1581
-
1582
- # Components of the URI in the order.
1583
- #
1584
- # source://uri//lib/uri/generic.rb#57
1585
- def component; end
1586
-
1587
- # Returns default port.
1588
- #
1589
- # source://uri//lib/uri/generic.rb#32
1590
- def default_port; end
1591
-
1592
- # @return [Boolean]
1593
- #
1594
- # source://uri//lib/uri/generic.rb#1556
1595
- def use_proxy?(hostname, addr, port, no_proxy); end
1596
-
1597
- # source://uri//lib/uri/generic.rb#63
1598
- def use_registry; end
1599
- end
1600
- end
1601
-
1602
- # The syntax of HTTP URIs is defined in RFC1738 section 3.3.
1603
- #
1604
- # Note that the Ruby URI library allows HTTP URLs containing usernames and
1605
- # passwords. This is not legal as per the RFC, but used to be
1606
- # supported in Internet Explorer 5 and 6, before the MS04-004 security
1607
- # update. See <URL:http://support.microsoft.com/kb/834489>.
1608
- #
1609
- # source://uri//lib/uri/http.rb#22
1610
- class URI::HTTP < ::URI::Generic
1611
- # == Description
1612
- #
1613
- # Returns the authority for an HTTP uri, as defined in
1614
- # https://www.rfc-editor.org/rfc/rfc3986#section-3.2.
1615
- #
1616
- #
1617
- # Example:
1618
- #
1619
- # URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com"
1620
- # URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000"
1621
- # URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com"
1622
- #
1623
- # source://uri//lib/uri/http.rb#97
1624
- def authority; end
1625
-
1626
- # == Description
1627
- #
1628
- # Returns the origin for an HTTP uri, as defined in
1629
- # https://www.rfc-editor.org/rfc/rfc6454.
1630
- #
1631
- #
1632
- # Example:
1633
- #
1634
- # URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com"
1635
- # URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000"
1636
- # URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com"
1637
- # URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com"
1638
- #
1639
- # source://uri//lib/uri/http.rb#119
1640
- def origin; end
1641
-
1642
- # == Description
1643
- #
1644
- # Returns the full path for an HTTP request, as required by Net::HTTP::Get.
1645
- #
1646
- # If the URI contains a query, the full path is URI#path + '?' + URI#query.
1647
- # Otherwise, the path is simply URI#path.
1648
- #
1649
- # Example:
1650
- #
1651
- # uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true')
1652
- # uri.request_uri # => "/foo/bar?test=true"
1653
- #
1654
- # source://uri//lib/uri/http.rb#77
1655
- def request_uri; end
1656
-
1657
- class << self
1658
- # == Description
1659
- #
1660
- # Creates a new URI::HTTP object from components, with syntax checking.
1661
- #
1662
- # The components accepted are userinfo, host, port, path, query, and
1663
- # fragment.
1664
- #
1665
- # The components should be provided either as an Array, or as a Hash
1666
- # with keys formed by preceding the component names with a colon.
1667
- #
1668
- # If an Array is used, the components must be passed in the
1669
- # order <code>[userinfo, host, port, path, query, fragment]</code>.
1670
- #
1671
- # Example:
1672
- #
1673
- # uri = URI::HTTP.build(host: 'www.example.com', path: '/foo/bar')
1674
- #
1675
- # uri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
1676
- # "query", 'fragment'])
1677
- #
1678
- # Currently, if passed userinfo components this method generates
1679
- # invalid HTTP URIs as per RFC 1738.
1680
- #
1681
- # source://uri//lib/uri/http.rb#59
1682
- def build(args); end
1683
- end
1684
- end
1685
-
1686
- # source://uri//lib/uri/common.rb#126
1687
- URI::INITIAL_SCHEMES = T.let(T.unsafe(nil), Hash)
1688
-
1689
- # LDAP URI SCHEMA (described in RFC2255).
1690
- # --
1691
- # ldap://<host>/<dn>[?<attrs>[?<scope>[?<filter>[?<extensions>]]]]
1692
- # ++
1693
- #
1694
- # source://uri//lib/uri/ldap.rb#23
1695
- class URI::LDAP < ::URI::Generic
1696
- # == Description
1697
- #
1698
- # Creates a new URI::LDAP object from generic URI components as per
1699
- # RFC 2396. No LDAP-specific syntax checking is performed.
1700
- #
1701
- # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
1702
- # +opaque+, +query+, and +fragment+, in that order.
1703
- #
1704
- # Example:
1705
- #
1706
- # uri = URI::LDAP.new("ldap", nil, "ldap.example.com", nil, nil,
1707
- # "/dc=example;dc=com", nil, "query", nil)
1708
- #
1709
- # See also URI::Generic.new.
1710
- #
1711
- # @return [LDAP] a new instance of LDAP
1712
- #
1713
- # source://uri//lib/uri/ldap.rb#108
1714
- def initialize(*arg); end
1715
-
1716
- # Returns attributes.
1717
- #
1718
- # source://uri//lib/uri/ldap.rb#178
1719
- def attributes; end
1720
-
1721
- # Setter for attributes +val+.
1722
- #
1723
- # source://uri//lib/uri/ldap.rb#191
1724
- def attributes=(val); end
1725
-
1726
- # Returns dn.
1727
- #
1728
- # source://uri//lib/uri/ldap.rb#159
1729
- def dn; end
1730
-
1731
- # Setter for dn +val+.
1732
- #
1733
- # source://uri//lib/uri/ldap.rb#172
1734
- def dn=(val); end
1735
-
1736
- # Returns extensions.
1737
- #
1738
- # source://uri//lib/uri/ldap.rb#235
1739
- def extensions; end
1740
-
1741
- # Setter for extensions +val+.
1742
- #
1743
- # source://uri//lib/uri/ldap.rb#248
1744
- def extensions=(val); end
1745
-
1746
- # Returns filter.
1747
- #
1748
- # source://uri//lib/uri/ldap.rb#216
1749
- def filter; end
1750
-
1751
- # Setter for filter +val+.
1752
- #
1753
- # source://uri//lib/uri/ldap.rb#229
1754
- def filter=(val); end
1755
-
1756
- # Checks if URI has a path.
1757
- # For URI::LDAP this will return +false+.
1758
- #
1759
- # @return [Boolean]
1760
- #
1761
- # source://uri//lib/uri/ldap.rb#255
1762
- def hierarchical?; end
1763
-
1764
- # Returns scope.
1765
- #
1766
- # source://uri//lib/uri/ldap.rb#197
1767
- def scope; end
1768
-
1769
- # Setter for scope +val+.
1770
- #
1771
- # source://uri//lib/uri/ldap.rb#210
1772
- def scope=(val); end
1773
-
1774
- protected
1775
-
1776
- # Private setter for attributes +val+.
1777
- #
1778
- # source://uri//lib/uri/ldap.rb#183
1779
- def set_attributes(val); end
1780
-
1781
- # Private setter for dn +val+.
1782
- #
1783
- # source://uri//lib/uri/ldap.rb#164
1784
- def set_dn(val); end
1785
-
1786
- # Private setter for extensions +val+.
1787
- #
1788
- # source://uri//lib/uri/ldap.rb#240
1789
- def set_extensions(val); end
1790
-
1791
- # Private setter for filter +val+.
1792
- #
1793
- # source://uri//lib/uri/ldap.rb#221
1794
- def set_filter(val); end
1795
-
1796
- # Private setter for scope +val+.
1797
- #
1798
- # source://uri//lib/uri/ldap.rb#202
1799
- def set_scope(val); end
1800
-
1801
- private
1802
-
1803
- # Private method to assemble +query+ from +attributes+, +scope+, +filter+, and +extensions+.
1804
- #
1805
- # source://uri//lib/uri/ldap.rb#146
1806
- def build_path_query; end
1807
-
1808
- # Private method to cleanup +dn+ from using the +path+ component attribute.
1809
- #
1810
- # @raise [InvalidURIError]
1811
- #
1812
- # source://uri//lib/uri/ldap.rb#120
1813
- def parse_dn; end
1814
-
1815
- # Private method to cleanup +attributes+, +scope+, +filter+, and +extensions+
1816
- # from using the +query+ component attribute.
1817
- #
1818
- # source://uri//lib/uri/ldap.rb#128
1819
- def parse_query; end
1820
-
1821
- class << self
1822
- # == Description
1823
- #
1824
- # Creates a new URI::LDAP object from components, with syntax checking.
1825
- #
1826
- # The components accepted are host, port, dn, attributes,
1827
- # scope, filter, and extensions.
1828
- #
1829
- # The components should be provided either as an Array, or as a Hash
1830
- # with keys formed by preceding the component names with a colon.
1831
- #
1832
- # If an Array is used, the components must be passed in the
1833
- # order <code>[host, port, dn, attributes, scope, filter, extensions]</code>.
1834
- #
1835
- # Example:
1836
- #
1837
- # uri = URI::LDAP.build({:host => 'ldap.example.com',
1838
- # :dn => '/dc=example'})
1839
- #
1840
- # uri = URI::LDAP.build(["ldap.example.com", nil,
1841
- # "/dc=example;dc=com", "query", nil, nil, nil])
1842
- #
1843
- # source://uri//lib/uri/ldap.rb#74
1844
- def build(args); end
1845
- end
1846
- end
1847
-
1848
- # RFC6068, the mailto URL scheme.
1849
- #
1850
- # source://uri//lib/uri/mailto.rb#17
1851
- class URI::MailTo < ::URI::Generic
1852
- include ::URI::RFC2396_REGEXP
1853
-
1854
- # == Description
1855
- #
1856
- # Creates a new URI::MailTo object from generic URL components with
1857
- # no syntax checking.
1858
- #
1859
- # This method is usually called from URI::parse, which checks
1860
- # the validity of each component.
1861
- #
1862
- # @return [MailTo] a new instance of MailTo
1863
- #
1864
- # source://uri//lib/uri/mailto.rb#132
1865
- def initialize(*arg); end
1866
-
1867
- # E-mail headers set by the URL, as an Array of Arrays.
1868
- #
1869
- # source://uri//lib/uri/mailto.rb#166
1870
- def headers; end
1871
-
1872
- # Setter for headers +v+.
1873
- #
1874
- # source://uri//lib/uri/mailto.rb#232
1875
- def headers=(v); end
1876
-
1877
- # The primary e-mail address of the URL, as a String.
1878
- #
1879
- # source://uri//lib/uri/mailto.rb#163
1880
- def to; end
1881
-
1882
- # Setter for to +v+.
1883
- #
1884
- # source://uri//lib/uri/mailto.rb#200
1885
- def to=(v); end
1886
-
1887
- # Returns the RFC822 e-mail text equivalent of the URL, as a String.
1888
- #
1889
- # Example:
1890
- #
1891
- # require 'uri'
1892
- #
1893
- # uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr")
1894
- # uri.to_mailtext
1895
- # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
1896
- #
1897
- # source://uri//lib/uri/mailto.rb#268
1898
- def to_mailtext; end
1899
-
1900
- # Returns the RFC822 e-mail text equivalent of the URL, as a String.
1901
- #
1902
- # Example:
1903
- #
1904
- # require 'uri'
1905
- #
1906
- # uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr")
1907
- # uri.to_mailtext
1908
- # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
1909
- #
1910
- # source://uri//lib/uri/mailto.rb#268
1911
- def to_rfc822text; end
1912
-
1913
- # Constructs String from URI.
1914
- #
1915
- # source://uri//lib/uri/mailto.rb#239
1916
- def to_s; end
1917
-
1918
- protected
1919
-
1920
- # Private setter for headers +v+.
1921
- #
1922
- # source://uri//lib/uri/mailto.rb#221
1923
- def set_headers(v); end
1924
-
1925
- # Private setter for to +v+.
1926
- #
1927
- # source://uri//lib/uri/mailto.rb#194
1928
- def set_to(v); end
1929
-
1930
- private
1931
-
1932
- # Checks the headers +v+ component against either
1933
- # * HEADER_REGEXP
1934
- #
1935
- # source://uri//lib/uri/mailto.rb#208
1936
- def check_headers(v); end
1937
-
1938
- # Checks the to +v+ component.
1939
- #
1940
- # source://uri//lib/uri/mailto.rb#169
1941
- def check_to(v); end
1942
-
1943
- class << self
1944
- # == Description
1945
- #
1946
- # Creates a new URI::MailTo object from components, with syntax checking.
1947
- #
1948
- # Components can be provided as an Array or Hash. If an Array is used,
1949
- # the components must be supplied as <code>[to, headers]</code>.
1950
- #
1951
- # If a Hash is used, the keys are the component names preceded by colons.
1952
- #
1953
- # The headers can be supplied as a pre-encoded string, such as
1954
- # <code>"subject=subscribe&cc=address"</code>, or as an Array of Arrays
1955
- # like <code>[['subject', 'subscribe'], ['cc', 'address']]</code>.
1956
- #
1957
- # Examples:
1958
- #
1959
- # require 'uri'
1960
- #
1961
- # m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby'])
1962
- # m1.to_s # => "mailto:joe@example.com?subject=Ruby"
1963
- #
1964
- # m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]])
1965
- # m2.to_s # => "mailto:john@example.com?Subject=Ruby&Cc=jack@example.com"
1966
- #
1967
- # m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]})
1968
- # m3.to_s # => "mailto:listman@example.com?subject=subscribe"
1969
- #
1970
- # source://uri//lib/uri/mailto.rb#85
1971
- def build(args); end
1972
- end
1973
- end
1974
-
1975
- # Class that parses String's into URI's.
1976
- #
1977
- # It contains a Hash set of patterns and Regexp's that match and validate.
1978
- #
1979
- # source://uri//lib/uri/rfc2396_parser.rb#64
1980
- class URI::RFC2396_Parser
1981
- include ::URI::RFC2396_REGEXP
1982
-
1983
- # == Synopsis
1984
- #
1985
- # URI::Parser.new([opts])
1986
- #
1987
- # == Args
1988
- #
1989
- # The constructor accepts a hash as options for parser.
1990
- # Keys of options are pattern names of URI components
1991
- # and values of options are pattern strings.
1992
- # The constructor generates set of regexps for parsing URIs.
1993
- #
1994
- # You can use the following keys:
1995
- #
1996
- # * :ESCAPED (URI::PATTERN::ESCAPED in default)
1997
- # * :UNRESERVED (URI::PATTERN::UNRESERVED in default)
1998
- # * :DOMLABEL (URI::PATTERN::DOMLABEL in default)
1999
- # * :TOPLABEL (URI::PATTERN::TOPLABEL in default)
2000
- # * :HOSTNAME (URI::PATTERN::HOSTNAME in default)
2001
- #
2002
- # == Examples
2003
- #
2004
- # p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
2005
- # u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP http://example.jp/%uABCD>
2006
- # URI.parse(u.to_s) #=> raises URI::InvalidURIError
2007
- #
2008
- # s = "http://example.com/ABCD"
2009
- # u1 = p.parse(s) #=> #<URI::HTTP http://example.com/ABCD>
2010
- # u2 = URI.parse(s) #=> #<URI::HTTP http://example.com/ABCD>
2011
- # u1 == u2 #=> true
2012
- # u1.eql?(u2) #=> false
2013
- #
2014
- # @return [RFC2396_Parser] a new instance of RFC2396_Parser
2015
- #
2016
- # source://uri//lib/uri/rfc2396_parser.rb#99
2017
- def initialize(opts = T.unsafe(nil)); end
2018
-
2019
- # :call-seq:
2020
- # escape( str )
2021
- # escape( str, unsafe )
2022
- #
2023
- # == Args
2024
- #
2025
- # +str+::
2026
- # String to make safe
2027
- # +unsafe+::
2028
- # Regexp to apply. Defaults to +self.regexp[:UNSAFE]+
2029
- #
2030
- # == Description
2031
- #
2032
- # Constructs a safe String from +str+, removing unsafe characters,
2033
- # replacing them with codes.
2034
- #
2035
- # source://uri//lib/uri/rfc2396_parser.rb#287
2036
- def escape(str, unsafe = T.unsafe(nil)); end
2037
-
2038
- # :call-seq:
2039
- # extract( str )
2040
- # extract( str, schemes )
2041
- # extract( str, schemes ) {|item| block }
2042
- #
2043
- # == Args
2044
- #
2045
- # +str+::
2046
- # String to search
2047
- # +schemes+::
2048
- # Patterns to apply to +str+
2049
- #
2050
- # == Description
2051
- #
2052
- # Attempts to parse and merge a set of URIs.
2053
- # If no +block+ given, then returns the result,
2054
- # else it calls +block+ for each element in result.
2055
- #
2056
- # See also URI::Parser.make_regexp.
2057
- #
2058
- # source://uri//lib/uri/rfc2396_parser.rb#249
2059
- def extract(str, schemes = T.unsafe(nil)); end
2060
-
2061
- # source://uri//lib/uri/rfc2396_parser.rb#326
2062
- def inspect; end
2063
-
2064
- # == Args
2065
- #
2066
- # +uris+::
2067
- # an Array of Strings
2068
- #
2069
- # == Description
2070
- #
2071
- # Attempts to parse and merge a set of URIs.
2072
- #
2073
- # source://uri//lib/uri/rfc2396_parser.rb#223
2074
- def join(*uris); end
2075
-
2076
- # Returns Regexp that is default +self.regexp[:ABS_URI_REF]+,
2077
- # unless +schemes+ is provided. Then it is a Regexp.union with +self.pattern[:X_ABS_URI]+.
2078
- #
2079
- # source://uri//lib/uri/rfc2396_parser.rb#262
2080
- def make_regexp(schemes = T.unsafe(nil)); end
2081
-
2082
- # == Args
2083
- #
2084
- # +uri+::
2085
- # String
2086
- #
2087
- # == Description
2088
- #
2089
- # Parses +uri+ and constructs either matching URI scheme object
2090
- # (File, FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic.
2091
- #
2092
- # == Usage
2093
- #
2094
- # p = URI::Parser.new
2095
- # p.parse("ldap://ldap.example.com/dc=example?user=john")
2096
- # #=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>
2097
- #
2098
- # source://uri//lib/uri/rfc2396_parser.rb#209
2099
- def parse(uri); end
2100
-
2101
- # The Hash of patterns.
2102
- #
2103
- # See also URI::Parser.initialize_pattern.
2104
- #
2105
- # source://uri//lib/uri/rfc2396_parser.rb#112
2106
- def pattern; end
2107
-
2108
- # The Hash of Regexp.
2109
- #
2110
- # See also URI::Parser.initialize_regexp.
2111
- #
2112
- # source://uri//lib/uri/rfc2396_parser.rb#117
2113
- def regexp; end
2114
-
2115
- # Returns a split URI against +regexp[:ABS_URI]+.
2116
- #
2117
- # source://uri//lib/uri/rfc2396_parser.rb#120
2118
- def split(uri); end
2119
-
2120
- # :call-seq:
2121
- # unescape( str )
2122
- # unescape( str, escaped )
2123
- #
2124
- # == Args
2125
- #
2126
- # +str+::
2127
- # String to remove escapes from
2128
- # +escaped+::
2129
- # Regexp to apply. Defaults to +self.regexp[:ESCAPED]+
2130
- #
2131
- # == Description
2132
- #
2133
- # Removes escapes from +str+.
2134
- #
2135
- # source://uri//lib/uri/rfc2396_parser.rb#318
2136
- def unescape(str, escaped = T.unsafe(nil)); end
2137
-
2138
- private
2139
-
2140
- # source://uri//lib/uri/rfc2396_parser.rb#527
2141
- def convert_to_uri(uri); end
2142
-
2143
- # Constructs the default Hash of patterns.
2144
- #
2145
- # source://uri//lib/uri/rfc2396_parser.rb#338
2146
- def initialize_pattern(opts = T.unsafe(nil)); end
2147
-
2148
- # Constructs the default Hash of Regexp's.
2149
- #
2150
- # source://uri//lib/uri/rfc2396_parser.rb#496
2151
- def initialize_regexp(pattern); end
2152
- end
2153
-
2154
- # source://uri//lib/uri/rfc3986_parser.rb#3
2155
- class URI::RFC3986_Parser
2156
- # @return [RFC3986_Parser] a new instance of RFC3986_Parser
2157
- #
2158
- # source://uri//lib/uri/rfc3986_parser.rb#73
2159
- def initialize; end
2160
-
2161
- # Compatibility for RFC2396 parser
2162
- #
2163
- # source://uri//lib/uri/rfc3986_parser.rb#156
2164
- def escape(str, unsafe = T.unsafe(nil)); end
2165
-
2166
- # Compatibility for RFC2396 parser
2167
- #
2168
- # source://uri//lib/uri/rfc3986_parser.rb#144
2169
- def extract(str, schemes = T.unsafe(nil), &block); end
2170
-
2171
- # source://uri//lib/uri/rfc3986_parser.rb#169
2172
- def inspect; end
2173
-
2174
- # source://uri//lib/uri/rfc3986_parser.rb#138
2175
- def join(*uris); end
2176
-
2177
- # Compatibility for RFC2396 parser
2178
- #
2179
- # source://uri//lib/uri/rfc3986_parser.rb#150
2180
- def make_regexp(schemes = T.unsafe(nil)); end
2181
-
2182
- # source://uri//lib/uri/rfc3986_parser.rb#134
2183
- def parse(uri); end
2184
-
2185
- # Returns the value of attribute regexp.
2186
- #
2187
- # source://uri//lib/uri/rfc3986_parser.rb#71
2188
- def regexp; end
2189
-
2190
- # source://uri//lib/uri/rfc3986_parser.rb#77
2191
- def split(uri); end
2192
-
2193
- # Compatibility for RFC2396 parser
2194
- #
2195
- # source://uri//lib/uri/rfc3986_parser.rb#162
2196
- def unescape(str, escaped = T.unsafe(nil)); end
2197
-
2198
- private
2199
-
2200
- # source://uri//lib/uri/rfc3986_parser.rb#194
2201
- def convert_to_uri(uri); end
2202
-
2203
- # source://uri//lib/uri/rfc3986_parser.rb#180
2204
- def default_regexp; end
2205
- end
2206
-
2207
- # source://uri//lib/uri/rfc3986_parser.rb#33
2208
- URI::RFC3986_Parser::FRAGMENT = T.let(T.unsafe(nil), String)
2209
-
2210
- # URI defined in RFC3986
2211
- #
2212
- # source://uri//lib/uri/rfc3986_parser.rb#5
2213
- URI::RFC3986_Parser::HOST = T.let(T.unsafe(nil), Regexp)
2214
-
2215
- # source://uri//lib/uri/rfc3986_parser.rb#54
2216
- URI::RFC3986_Parser::RFC3986_relative_ref = T.let(T.unsafe(nil), Regexp)
2217
-
2218
- # source://uri//lib/uri/rfc3986_parser.rb#30
2219
- URI::RFC3986_Parser::SCHEME = T.let(T.unsafe(nil), String)
2220
-
2221
- # source://uri//lib/uri/rfc3986_parser.rb#31
2222
- URI::RFC3986_Parser::SEG = T.let(T.unsafe(nil), String)
2223
-
2224
- # source://uri//lib/uri/rfc3986_parser.rb#32
2225
- URI::RFC3986_Parser::SEG_NC = T.let(T.unsafe(nil), String)
2226
-
2227
- # source://uri//lib/uri/rfc3986_parser.rb#28
2228
- URI::RFC3986_Parser::USERINFO = T.let(T.unsafe(nil), Regexp)
2229
-
2230
- # source://uri//lib/uri/common.rb#90
2231
- module URI::Schemes; end
2232
-
2233
- # source://uri//lib/uri/common.rb#103
2234
- URI::Schemes::FILE = URI::File
2235
-
2236
- # source://uri//lib/uri/common.rb#103
2237
- URI::Schemes::FTP = URI::FTP
2238
-
2239
- # source://uri//lib/uri/common.rb#103
2240
- URI::Schemes::HTTP = URI::HTTP
2241
-
2242
- # source://uri//lib/uri/common.rb#103
2243
- URI::Schemes::HTTPS = URI::HTTPS
2244
-
2245
- # source://uri//lib/uri/common.rb#103
2246
- URI::Schemes::LDAP = URI::LDAP
2247
-
2248
- # source://uri//lib/uri/common.rb#103
2249
- URI::Schemes::LDAPS = URI::LDAPS
2250
-
2251
- # source://uri//lib/uri/common.rb#103
2252
- URI::Schemes::MAILTO = URI::MailTo
2253
-
2254
- # source://uri//lib/uri/common.rb#103
2255
- URI::Schemes::SOURCE = URI::Source
2256
-
2257
- # source://uri//lib/uri/common.rb#103
2258
- URI::Schemes::WS = URI::WS
2259
-
2260
- # source://uri//lib/uri/common.rb#103
2261
- URI::Schemes::WSS = URI::WSS
2262
-
2263
- class URI::Source < ::URI::File
2264
- # source://tapioca/0.16.4/lib/tapioca/helpers/source_uri.rb#65
2265
- sig { params(v: T.nilable(::String)).returns(T::Boolean) }
2266
- def check_host(v); end
2267
-
2268
- # source://uri//lib/uri/generic.rb#243
2269
- def gem_name; end
2270
-
2271
- # source://tapioca/0.16.4/lib/tapioca/helpers/source_uri.rb#32
2272
- sig { returns(T.nilable(::String)) }
2273
- def gem_version; end
2274
-
2275
- # source://uri//lib/uri/generic.rb#283
2276
- def line_number; end
2277
-
2278
- # source://tapioca/0.16.4/lib/tapioca/helpers/source_uri.rb#58
2279
- sig { params(v: T.nilable(::String)).void }
2280
- def set_path(v); end
2281
-
2282
- # source://tapioca/0.16.4/lib/tapioca/helpers/source_uri.rb#77
2283
- sig { returns(::String) }
2284
- def to_s; end
2285
-
2286
- class << self
2287
- # source://tapioca/0.16.4/lib/tapioca/helpers/source_uri.rb#45
2288
- sig do
2289
- params(
2290
- gem_name: ::String,
2291
- gem_version: T.nilable(::String),
2292
- path: ::String,
2293
- line_number: T.nilable(::String)
2294
- ).returns(::URI::Source)
2295
- end
2296
- def build(gem_name:, gem_version:, path:, line_number:); end
2297
- end
2298
- end
2299
-
2300
- # source://uri//lib/uri/common.rb#308
2301
- URI::TBLENCURICOMP_ = T.let(T.unsafe(nil), Hash)
2302
-
2303
- # source://uri//lib/uri/common.rb#58
2304
- module URI::Util
2305
- private
2306
-
2307
- # source://uri//lib/uri/common.rb#59
2308
- def make_components_hash(klass, array_hash); end
2309
-
2310
- class << self
2311
- # source://uri//lib/uri/common.rb#59
2312
- def make_components_hash(klass, array_hash); end
2313
- end
2314
- end
2315
-
2316
- # The syntax of WS URIs is defined in RFC6455 section 3.
2317
- #
2318
- # Note that the Ruby URI library allows WS URLs containing usernames and
2319
- # passwords. This is not legal as per the RFC, but used to be
2320
- # supported in Internet Explorer 5 and 6, before the MS04-004 security
2321
- # update. See <URL:http://support.microsoft.com/kb/834489>.
2322
- #
2323
- # source://uri//lib/uri/ws.rb#22
2324
- class URI::WS < ::URI::Generic
2325
- # == Description
2326
- #
2327
- # Returns the full path for a WS URI, as required by Net::HTTP::Get.
2328
- #
2329
- # If the URI contains a query, the full path is URI#path + '?' + URI#query.
2330
- # Otherwise, the path is simply URI#path.
2331
- #
2332
- # Example:
2333
- #
2334
- # uri = URI::WS.build(path: '/foo/bar', query: 'test=true')
2335
- # uri.request_uri # => "/foo/bar?test=true"
2336
- #
2337
- # source://uri//lib/uri/ws.rb#74
2338
- def request_uri; end
2339
-
2340
- class << self
2341
- # == Description
2342
- #
2343
- # Creates a new URI::WS object from components, with syntax checking.
2344
- #
2345
- # The components accepted are userinfo, host, port, path, and query.
2346
- #
2347
- # The components should be provided either as an Array, or as a Hash
2348
- # with keys formed by preceding the component names with a colon.
2349
- #
2350
- # If an Array is used, the components must be passed in the
2351
- # order <code>[userinfo, host, port, path, query]</code>.
2352
- #
2353
- # Example:
2354
- #
2355
- # uri = URI::WS.build(host: 'www.example.com', path: '/foo/bar')
2356
- #
2357
- # uri = URI::WS.build([nil, "www.example.com", nil, "/path", "query"])
2358
- #
2359
- # Currently, if passed userinfo components this method generates
2360
- # invalid WS URIs as per RFC 1738.
2361
- #
2362
- # source://uri//lib/uri/ws.rb#56
2363
- def build(args); end
2364
- end
2365
- end
2366
-
2367
- # The default port for WSS URIs is 443, and the scheme is 'wss:' rather
2368
- # than 'ws:'. Other than that, WSS URIs are identical to WS URIs;
2369
- # see URI::WS.
2370
- #
2371
- # source://uri//lib/uri/wss.rb#17
2372
- class URI::WSS < ::URI::WS; end
2373
-
2374
- # A Default port of 443 for URI::WSS
2375
- #
2376
- # source://uri//lib/uri/wss.rb#19
2377
- URI::WSS::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)