roast-ai 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +2 -0
  3. data/.github/workflows/ci.yaml +1 -0
  4. data/.gitignore +0 -26
  5. data/.rubocop.yml +13 -0
  6. data/.rubocop_todo.yml +21 -0
  7. data/CHANGELOG.md +29 -0
  8. data/Gemfile +4 -0
  9. data/Gemfile.lock +47 -29
  10. data/bin/rubocop +27 -0
  11. data/bin/spoom +27 -0
  12. data/bin/srb +27 -0
  13. data/bin/srb-rbi +27 -0
  14. data/bin/tapioca +27 -0
  15. data/docs/INSTRUMENTATION.md +3 -3
  16. data/dsl/simple.rb +10 -0
  17. data/lib/roast/dsl/executor.rb +26 -0
  18. data/lib/roast/dsl.rb +7 -0
  19. data/lib/roast/errors.rb +1 -0
  20. data/lib/roast/factories/api_provider_factory.rb +1 -0
  21. data/lib/roast/helpers/function_caching_interceptor.rb +3 -0
  22. data/lib/roast/helpers/logger.rb +6 -9
  23. data/lib/roast/helpers/metadata_access.rb +1 -0
  24. data/lib/roast/helpers/minitest_coverage_runner.rb +1 -0
  25. data/lib/roast/helpers/path_resolver.rb +8 -18
  26. data/lib/roast/helpers/prompt_loader.rb +3 -2
  27. data/lib/roast/helpers/timeout_handler.rb +3 -5
  28. data/lib/roast/initializers.rb +1 -0
  29. data/lib/roast/resources/api_resource.rb +4 -3
  30. data/lib/roast/resources/base_resource.rb +1 -0
  31. data/lib/roast/resources/directory_resource.rb +1 -0
  32. data/lib/roast/resources/file_resource.rb +1 -0
  33. data/lib/roast/resources/none_resource.rb +1 -0
  34. data/lib/roast/resources/url_resource.rb +2 -1
  35. data/lib/roast/resources.rb +1 -2
  36. data/lib/roast/services/context_threshold_checker.rb +1 -0
  37. data/lib/roast/services/token_counting_service.rb +1 -0
  38. data/lib/roast/tools/apply_diff.rb +1 -0
  39. data/lib/roast/tools/ask_user.rb +1 -0
  40. data/lib/roast/tools/bash.rb +1 -0
  41. data/lib/roast/tools/cmd.rb +1 -0
  42. data/lib/roast/tools/coding_agent.rb +1 -0
  43. data/lib/roast/tools/context_summarizer.rb +1 -0
  44. data/lib/roast/tools/grep.rb +1 -0
  45. data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -0
  46. data/lib/roast/tools/read_file.rb +1 -0
  47. data/lib/roast/tools/search_file.rb +1 -0
  48. data/lib/roast/tools/swarm.rb +1 -0
  49. data/lib/roast/tools/update_files.rb +1 -0
  50. data/lib/roast/tools/write_file.rb +1 -0
  51. data/lib/roast/tools.rb +2 -0
  52. data/lib/roast/value_objects/api_token.rb +1 -0
  53. data/lib/roast/value_objects/step_name.rb +1 -0
  54. data/lib/roast/value_objects/uri_base.rb +1 -0
  55. data/lib/roast/value_objects/workflow_path.rb +1 -0
  56. data/lib/roast/value_objects.rb +1 -0
  57. data/lib/roast/version.rb +2 -1
  58. data/lib/roast/workflow/agent_step.rb +1 -0
  59. data/lib/roast/workflow/api_configuration.rb +1 -0
  60. data/lib/roast/workflow/base_iteration_step.rb +1 -0
  61. data/lib/roast/workflow/base_step.rb +1 -0
  62. data/lib/roast/workflow/base_workflow.rb +1 -0
  63. data/lib/roast/workflow/case_executor.rb +1 -0
  64. data/lib/roast/workflow/case_step.rb +1 -0
  65. data/lib/roast/workflow/command_executor.rb +1 -0
  66. data/lib/roast/workflow/conditional_executor.rb +1 -0
  67. data/lib/roast/workflow/conditional_step.rb +1 -0
  68. data/lib/roast/workflow/configuration.rb +9 -0
  69. data/lib/roast/workflow/configuration_loader.rb +4 -1
  70. data/lib/roast/workflow/context_manager.rb +1 -0
  71. data/lib/roast/workflow/context_path_resolver.rb +1 -0
  72. data/lib/roast/workflow/dot_access_hash.rb +1 -0
  73. data/lib/roast/workflow/each_step.rb +1 -0
  74. data/lib/roast/workflow/error_handler.rb +7 -1
  75. data/lib/roast/workflow/expression_evaluator.rb +1 -0
  76. data/lib/roast/workflow/expression_utils.rb +1 -0
  77. data/lib/roast/workflow/file_state_repository.rb +2 -1
  78. data/lib/roast/workflow/input_executor.rb +1 -0
  79. data/lib/roast/workflow/input_step.rb +1 -0
  80. data/lib/roast/workflow/interpolator.rb +2 -1
  81. data/lib/roast/workflow/iteration_executor.rb +1 -0
  82. data/lib/roast/workflow/llm_boolean_coercer.rb +1 -0
  83. data/lib/roast/workflow/metadata_manager.rb +1 -0
  84. data/lib/roast/workflow/output_handler.rb +1 -0
  85. data/lib/roast/workflow/output_manager.rb +1 -0
  86. data/lib/roast/workflow/parallel_executor.rb +1 -0
  87. data/lib/roast/workflow/prompt_step.rb +1 -0
  88. data/lib/roast/workflow/repeat_step.rb +1 -0
  89. data/lib/roast/workflow/replay_handler.rb +1 -0
  90. data/lib/roast/workflow/resource_resolver.rb +2 -6
  91. data/lib/roast/workflow/session_manager.rb +1 -0
  92. data/lib/roast/workflow/shell_script_step.rb +1 -0
  93. data/lib/roast/workflow/sqlite_state_repository.rb +1 -0
  94. data/lib/roast/workflow/state_manager.rb +1 -0
  95. data/lib/roast/workflow/state_repository.rb +1 -0
  96. data/lib/roast/workflow/state_repository_factory.rb +4 -2
  97. data/lib/roast/workflow/step_completion_reporter.rb +1 -0
  98. data/lib/roast/workflow/step_executor_coordinator.rb +9 -5
  99. data/lib/roast/workflow/step_executor_factory.rb +1 -0
  100. data/lib/roast/workflow/step_executor_registry.rb +2 -3
  101. data/lib/roast/workflow/step_executor_with_reporting.rb +1 -0
  102. data/lib/roast/workflow/step_executors/base_step_executor.rb +1 -0
  103. data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -0
  104. data/lib/roast/workflow/step_executors/parallel_step_executor.rb +1 -0
  105. data/lib/roast/workflow/step_executors/string_step_executor.rb +1 -0
  106. data/lib/roast/workflow/step_factory.rb +1 -0
  107. data/lib/roast/workflow/step_finder.rb +1 -0
  108. data/lib/roast/workflow/step_loader.rb +1 -0
  109. data/lib/roast/workflow/step_name_extractor.rb +1 -0
  110. data/lib/roast/workflow/step_runner.rb +1 -0
  111. data/lib/roast/workflow/step_type_resolver.rb +1 -0
  112. data/lib/roast/workflow/validation_command.rb +1 -0
  113. data/lib/roast/workflow/validator.rb +1 -0
  114. data/lib/roast/workflow/validators/base_validator.rb +1 -0
  115. data/lib/roast/workflow/validators/dependency_validator.rb +1 -0
  116. data/lib/roast/workflow/validators/linting_validator.rb +1 -0
  117. data/lib/roast/workflow/validators/schema_validator.rb +1 -0
  118. data/lib/roast/workflow/validators/step_collector.rb +1 -0
  119. data/lib/roast/workflow/validators/validation_orchestrator.rb +1 -0
  120. data/lib/roast/workflow/workflow_context.rb +1 -0
  121. data/lib/roast/workflow/workflow_execution_context.rb +1 -0
  122. data/lib/roast/workflow/workflow_executor.rb +2 -1
  123. data/lib/roast/workflow/workflow_initializer.rb +1 -0
  124. data/lib/roast/workflow/workflow_runner.rb +66 -55
  125. data/lib/roast/workflow.rb +1 -0
  126. data/lib/roast/workflow_diagram_generator.rb +3 -2
  127. data/lib/roast.rb +23 -8
  128. data/roast.gemspec +1 -1
  129. data/sorbet/config +8 -0
  130. data/sorbet/rbi/dsl/.gitattributes +1 -0
  131. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  132. data/sorbet/rbi/gems/.gitattributes +1 -0
  133. data/sorbet/rbi/gems/activesupport@8.0.2.rbi +19107 -0
  134. data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
  135. data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
  136. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  137. data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
  138. data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +62 -0
  139. data/sorbet/rbi/gems/cgi@0.5.0.rbi +2961 -0
  140. data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +568 -0
  141. data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +1991 -0
  142. data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
  143. data/sorbet/rbi/gems/coderay@1.1.3.rbi +9 -0
  144. data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11657 -0
  145. data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
  146. data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
  147. data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +972 -0
  148. data/sorbet/rbi/gems/dotenv@3.1.8.rbi +295 -0
  149. data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
  150. data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +672 -0
  151. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +1894 -0
  152. data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +659 -0
  153. data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +781 -0
  154. data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +1127 -0
  155. data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +3727 -0
  156. data/sorbet/rbi/gems/dry-types@1.8.3.rbi +3969 -0
  157. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  158. data/sorbet/rbi/gems/event_stream_parser@1.0.0.rbi +49 -0
  159. data/sorbet/rbi/gems/faraday-multipart@1.1.1.rbi +283 -0
  160. data/sorbet/rbi/gems/faraday-net_http@3.4.1.rbi +147 -0
  161. data/sorbet/rbi/gems/faraday-retry@2.3.2.rbi +9 -0
  162. data/sorbet/rbi/gems/faraday@2.13.1.rbi +2977 -0
  163. data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +1588 -0
  164. data/sorbet/rbi/gems/ffi@1.17.2.rbi +9 -0
  165. data/sorbet/rbi/gems/formatador@1.1.0.rbi +9 -0
  166. data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +102 -0
  167. data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +402 -0
  168. data/sorbet/rbi/gems/guard@2.19.1.rbi +2283 -0
  169. data/sorbet/rbi/gems/hashdiff@1.2.0.rbi +355 -0
  170. data/sorbet/rbi/gems/i18n@1.14.7.rbi +2359 -0
  171. data/sorbet/rbi/gems/json-schema@5.1.1.rbi +1466 -0
  172. data/sorbet/rbi/gems/json@2.12.2.rbi +2051 -0
  173. data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
  174. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +9 -0
  175. data/sorbet/rbi/gems/listen@3.9.0.rbi +1206 -0
  176. data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
  177. data/sorbet/rbi/gems/lumberjack@1.2.10.rbi +1830 -0
  178. data/sorbet/rbi/gems/method_source@1.1.0.rbi +9 -0
  179. data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +136 -0
  180. data/sorbet/rbi/gems/mime-types@3.7.0.rbi +1342 -0
  181. data/sorbet/rbi/gems/minitest-rg@5.3.0.rbi +160 -0
  182. data/sorbet/rbi/gems/minitest@5.25.5.rbi +1640 -0
  183. data/sorbet/rbi/gems/mocha@2.7.1.rbi +12 -0
  184. data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +244 -0
  185. data/sorbet/rbi/gems/nenv@0.3.0.rbi +147 -0
  186. data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
  187. data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
  188. data/sorbet/rbi/gems/notiffany@0.1.3.rbi +1079 -0
  189. data/sorbet/rbi/gems/open_router@0.3.3.rbi +230 -0
  190. data/sorbet/rbi/gems/ostruct@0.6.2.rbi +354 -0
  191. data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
  192. data/sorbet/rbi/gems/parser@3.3.8.0.rbi +5535 -0
  193. data/sorbet/rbi/gems/prism@1.4.0.rbi +41732 -0
  194. data/sorbet/rbi/gems/pry@0.15.2.rbi +9 -0
  195. data/sorbet/rbi/gems/public_suffix@6.0.2.rbi +936 -0
  196. data/sorbet/rbi/gems/racc@1.8.1.rbi +158 -0
  197. data/sorbet/rbi/gems/rack@2.2.17.rbi +5659 -0
  198. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +9 -0
  199. data/sorbet/rbi/gems/raix@1.0.2.rbi +1104 -0
  200. data/sorbet/rbi/gems/rake@13.3.0.rbi +3036 -0
  201. data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +9 -0
  202. data/sorbet/rbi/gems/rb-inotify@0.11.1.rbi +9 -0
  203. data/sorbet/rbi/gems/rbi@0.3.6.rbi +6893 -0
  204. data/sorbet/rbi/gems/rbs@3.9.4.rbi +6978 -0
  205. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +9 -0
  206. data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
  207. data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +9 -0
  208. data/sorbet/rbi/gems/rubocop-shopify@2.17.1.rbi +9 -0
  209. data/sorbet/rbi/gems/rubocop@1.77.0.rbi +9 -0
  210. data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +1333 -0
  211. data/sorbet/rbi/gems/ruby-openai@8.1.0.rbi +758 -0
  212. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +9 -0
  213. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
  214. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  215. data/sorbet/rbi/gems/shellany@0.0.1.rbi +102 -0
  216. data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
  217. data/sorbet/rbi/gems/sqlite3@2.7.0.rbi +1900 -0
  218. data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
  219. data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
  220. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
  221. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +9 -0
  222. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +9 -0
  223. data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
  224. data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
  225. data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
  226. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
  227. data/sorbet/rbi/gems/yard@0.9.37.rbi +18492 -0
  228. data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1429 -0
  229. data/sorbet/tapioca/config.yml +13 -0
  230. data/sorbet/tapioca/require.rb +36 -0
  231. metadata +116 -5
  232. data/lib/roast/workflow/configuration_parser.rb +0 -54
@@ -0,0 +1,1342 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `mime-types` gem.
5
+ # Please instead update this file by running `bin/tapioca gem mime-types`.
6
+
7
+
8
+ # source://mime-types//lib/mime/types.rb#4
9
+ module MIME; end
10
+
11
+ # The definition of one MIME content-type.
12
+ #
13
+ # == Usage
14
+ # require "mime/types"
15
+ #
16
+ # plaintext = MIME::Types["text/plain"] # => [ text/plain ]
17
+ # text = plaintext.first
18
+ # puts text.media_type # => "text"
19
+ # puts text.sub_type # => "plain"
20
+ #
21
+ # puts text.extensions.join(" ") # => "txt asc c cc h hh cpp hpp dat hlp"
22
+ # puts text.preferred_extension # => "txt"
23
+ # puts text.friendly # => "Text Document"
24
+ # puts text.i18n_key # => "text.plain"
25
+ #
26
+ # puts text.encoding # => quoted-printable
27
+ # puts text.default_encoding # => quoted-printable
28
+ # puts text.binary? # => false
29
+ # puts text.ascii? # => true
30
+ # puts text.obsolete? # => false
31
+ # puts text.registered? # => true
32
+ # puts text.provisional? # => false
33
+ # puts text.complete? # => true
34
+ #
35
+ # puts text # => "text/plain"
36
+ #
37
+ # puts text == "text/plain" # => true
38
+ # puts "text/plain" == text # => true
39
+ # puts text == "text/x-plain" # => false
40
+ # puts "text/x-plain" == text # => false
41
+ #
42
+ # puts MIME::Type.simplified("x-appl/x-zip") # => "x-appl/x-zip"
43
+ # puts MIME::Type.i18n_key("x-appl/x-zip") # => "x-appl.x-zip"
44
+ #
45
+ # puts text.like?("text/x-plain") # => true
46
+ # puts text.like?(MIME::Type.new("content-type" => "x-text/x-plain")) # => true
47
+ #
48
+ # puts text.xrefs.inspect # => { "rfc" => [ "rfc2046", "rfc3676", "rfc5147" ] }
49
+ # puts text.xref_urls # => [ "http://www.iana.org/go/rfc2046",
50
+ # # "http://www.iana.org/go/rfc3676",
51
+ # # "http://www.iana.org/go/rfc5147" ]
52
+ #
53
+ # xtext = MIME::Type.new("x-text/x-plain")
54
+ # puts xtext.media_type # => "text"
55
+ # puts xtext.raw_media_type # => "x-text"
56
+ # puts xtext.sub_type # => "plain"
57
+ # puts xtext.raw_sub_type # => "x-plain"
58
+ # puts xtext.complete? # => false
59
+ #
60
+ # puts MIME::Types.any? { |type| type.content_type == "text/plain" } # => true
61
+ # puts MIME::Types.all?(&:registered?) # => false
62
+ #
63
+ # # Various string representations of MIME types
64
+ # qcelp = MIME::Types["audio/QCELP"].first # => audio/QCELP
65
+ # puts qcelp.content_type # => "audio/QCELP"
66
+ # puts qcelp.simplified # => "audio/qcelp"
67
+ #
68
+ # xwingz = MIME::Types["application/x-Wingz"].first # => application/x-Wingz
69
+ # puts xwingz.content_type # => "application/x-Wingz"
70
+ # puts xwingz.simplified # => "application/x-wingz"
71
+ #
72
+ # source://mime-types//lib/mime/type.rb#69
73
+ class MIME::Type
74
+ include ::Comparable
75
+
76
+ # Builds a MIME::Type object from the +content_type+, a MIME Content Type
77
+ # value (e.g., "text/plain" or "application/x-eruby"). The constructed object
78
+ # is yielded to an optional block for additional configuration, such as
79
+ # associating extensions and encoding information.
80
+ #
81
+ # * When provided a Hash or a MIME::Type, the MIME::Type will be
82
+ # constructed with #init_with.
83
+ #
84
+ # There are two deprecated initialization forms:
85
+ #
86
+ # * When provided an Array, the MIME::Type will be constructed using
87
+ # the first element as the content type and the remaining flattened
88
+ # elements as extensions.
89
+ # * Otherwise, the content_type will be used as a string.
90
+ #
91
+ # Yields the newly constructed +self+ object.
92
+ #
93
+ # @return [Type] a new instance of Type
94
+ # @yield [_self]
95
+ # @yieldparam _self [MIME::Type] the object that the method was called on
96
+ #
97
+ # source://mime-types//lib/mime/type.rb#133
98
+ def initialize(content_type); end
99
+
100
+ # Compares the +other+ MIME::Type against the exact content type or the
101
+ # simplified type (the simplified type will be used if comparing against
102
+ # something that can be treated as a String with #to_s). In comparisons, this
103
+ # is done against the lowercase version of the MIME::Type.
104
+ #
105
+ # Note that this implementation of #<=> is deprecated and will be changed
106
+ # in the next major version to be the same as #priority_compare.
107
+ #
108
+ # Note that MIME::Types no longer compare against nil.
109
+ #
110
+ # source://mime-types//lib/mime/type.rb#193
111
+ def <=>(other); end
112
+
113
+ # Uses a modified pre-computed sort priority value based on whether one of the provided
114
+ # extensions is the preferred extension for a type.
115
+ #
116
+ # This is an internal function. If an extension provided is a preferred extension either
117
+ # for this instance or the compared instance, the corresponding extension has its top
118
+ # _extension_ bit cleared from its sort priority. That means that a type with between
119
+ # 0 and 8 extensions will be treated as if it had 9 extensions.
120
+ #
121
+ # source://mime-types//lib/mime/type.rb#218
122
+ def __extension_priority_compare(other, exts); end
123
+
124
+ # The computed sort priority value. This is _not_ intended to be used by most
125
+ # callers.
126
+ #
127
+ # source://mime-types//lib/mime/type.rb#272
128
+ def __sort_priority; end
129
+
130
+ # Merge the +extensions+ provided into this MIME::Type. The extensions added
131
+ # will be merged uniquely.
132
+ #
133
+ # source://mime-types//lib/mime/type.rb#338
134
+ def add_extensions(*extensions); end
135
+
136
+ # MIME types can be specified to be sent across a network in particular
137
+ # formats. This method returns +false+ when the MIME::Type encoding is
138
+ # set to <tt>base64</tt>.
139
+ #
140
+ # @return [Boolean]
141
+ #
142
+ # source://mime-types//lib/mime/type.rb#516
143
+ def ascii?; end
144
+
145
+ # MIME types can be specified to be sent across a network in particular
146
+ # formats. This method returns +true+ when the MIME::Type encoding is set
147
+ # to <tt>base64</tt>.
148
+ #
149
+ # @return [Boolean]
150
+ #
151
+ # source://mime-types//lib/mime/type.rb#509
152
+ def binary?; end
153
+
154
+ # Returns +true+ if the MIME::Type specifies an extension list,
155
+ # indicating that it is a complete MIME::Type.
156
+ #
157
+ # @return [Boolean]
158
+ #
159
+ # source://mime-types//lib/mime/type.rb#526
160
+ def complete?; end
161
+
162
+ # Returns the whole MIME content-type string.
163
+ #
164
+ # The content type is a presentation value from the MIME type registry and
165
+ # should not be used for comparison. The case of the content type is
166
+ # preserved, and extension markers (<tt>x-</tt>) are kept.
167
+ #
168
+ # text/plain => text/plain
169
+ # x-chemical/x-pdb => x-chemical/x-pdb
170
+ # audio/QCELP => audio/QCELP
171
+ #
172
+ # source://mime-types//lib/mime/type.rb#286
173
+ def content_type; end
174
+
175
+ # Returns the default encoding for the MIME::Type based on the media type.
176
+ #
177
+ # source://mime-types//lib/mime/type.rb#391
178
+ def default_encoding; end
179
+
180
+ # The documentation for this MIME::Type.
181
+ #
182
+ # source://mime-types//lib/mime/type.rb#423
183
+ def docs; end
184
+
185
+ # The documentation for this MIME::Type.
186
+ #
187
+ # source://mime-types//lib/mime/type.rb#423
188
+ def docs=(_arg0); end
189
+
190
+ # Populates the +coder+ with attributes about this record for
191
+ # serialization. The structure of +coder+ should match the structure used
192
+ # with #init_with.
193
+ #
194
+ # This method should be considered a private implementation detail.
195
+ #
196
+ # source://mime-types//lib/mime/type.rb#560
197
+ def encode_with(coder); end
198
+
199
+ # Returns the value of attribute encoding.
200
+ #
201
+ # source://mime-types//lib/mime/type.rb#377
202
+ def encoding; end
203
+
204
+ # source://mime-types//lib/mime/type.rb#380
205
+ def encoding=(enc); end
206
+
207
+ # Returns +true+ if the +other+ object is a MIME::Type and the content types
208
+ # match.
209
+ #
210
+ # @return [Boolean]
211
+ #
212
+ # source://mime-types//lib/mime/type.rb#240
213
+ def eql?(other); end
214
+
215
+ # The list of extensions which are known to be used for this MIME::Type.
216
+ # Non-array values will be coerced into an array with #to_a. Array values
217
+ # will be flattened, +nil+ values removed, and made unique.
218
+ #
219
+ # :attr_accessor: extensions
220
+ #
221
+ # source://mime-types//lib/mime/type.rb#325
222
+ def extensions; end
223
+
224
+ # source://mime-types//lib/mime/type.rb#330
225
+ def extensions=(value); end
226
+
227
+ # A friendly short description for this MIME::Type.
228
+ #
229
+ # call-seq:
230
+ # text_plain.friendly # => "Text File"
231
+ # text_plain.friendly("en") # => "Text File"
232
+ #
233
+ # source://mime-types//lib/mime/type.rb#430
234
+ def friendly(lang = T.unsafe(nil)); end
235
+
236
+ # Returns a hash based on the #simplified value.
237
+ #
238
+ # This maintains the invariant that two #eql? instances must have the same
239
+ # #hash (although having the same #hash does *not* imply that the objects are
240
+ # #eql?).
241
+ #
242
+ # To see why, suppose a MIME::Type instance +a+ is compared to another object
243
+ # +b+, and that <code>a.eql?(b)</code> is true. By the definition of #eql?,
244
+ # we know the following:
245
+ #
246
+ # 1. +b+ is a MIME::Type instance itself.
247
+ # 2. <code>a == b</code> is true.
248
+ #
249
+ # Due to the first point, we know that +b+ should respond to the #simplified
250
+ # method. Thus, per the definition of #<=>, we know that +a.simplified+ must
251
+ # be equal to +b.simplified+, as compared by the <=> method corresponding to
252
+ # +a.simplified+.
253
+ #
254
+ # Presumably, if <code>a.simplified <=> b.simplified</code> is +0+, then
255
+ # +a.simplified+ has the same hash as +b.simplified+. So we assume it is
256
+ # suitable for #hash to delegate to #simplified in service of the #eql?
257
+ # invariant.
258
+ #
259
+ # source://mime-types//lib/mime/type.rb#266
260
+ def hash; end
261
+
262
+ # A key suitable for use as a lookup key for translations, such as with
263
+ # the I18n library.
264
+ #
265
+ # call-seq:
266
+ # text_plain.i18n_key # => "text.plain"
267
+ # 3gpp_xml.i18n_key # => "application.vnd-3gpp-bsf-xml"
268
+ # # from application/vnd.3gpp.bsf+xml
269
+ # x_msword.i18n_key # => "application.word"
270
+ # # from application/x-msword
271
+ #
272
+ # source://mime-types//lib/mime/type.rb#455
273
+ def i18n_key; end
274
+
275
+ # Initialize an empty object from +coder+, which must contain the
276
+ # attributes necessary for initializing an empty object.
277
+ #
278
+ # This method should be considered a private implementation detail.
279
+ #
280
+ # source://mime-types//lib/mime/type.rb#590
281
+ def init_with(coder); end
282
+
283
+ # source://mime-types//lib/mime/type.rb#609
284
+ def inspect; end
285
+
286
+ # Indicates that a MIME type is like another type. This differs from
287
+ # <tt>==</tt> because <tt>x-</tt> prefixes are removed for this comparison.
288
+ #
289
+ # @return [Boolean]
290
+ #
291
+ # source://mime-types//lib/mime/type.rb#174
292
+ def like?(other); end
293
+
294
+ # Returns the media type of the simplified MIME::Type.
295
+ #
296
+ # text/plain => text
297
+ # x-chemical/x-pdb => x-chemical
298
+ # audio/QCELP => audio
299
+ #
300
+ # source://mime-types//lib/mime/type.rb#299
301
+ def media_type; end
302
+
303
+ # Returns +true+ if the media type is obsolete.
304
+ #
305
+ # :attr_accessor: obsolete
306
+ #
307
+ # source://mime-types//lib/mime/type.rb#413
308
+ def obsolete; end
309
+
310
+ # source://mime-types//lib/mime/type.rb#417
311
+ def obsolete=(value); end
312
+
313
+ # Returns +true+ if the media type is obsolete.
314
+ #
315
+ # :attr_accessor: obsolete
316
+ #
317
+ # source://mime-types//lib/mime/type.rb#413
318
+ def obsolete?; end
319
+
320
+ # source://mime-types//lib/mime/type.rb#352
321
+ def preferred_extension; end
322
+
323
+ # source://mime-types//lib/mime/type.rb#357
324
+ def preferred_extension=(value); end
325
+
326
+ # Compares the +other+ MIME::Type using a pre-computed sort priority value,
327
+ # then the simplified representation for an alphabetical sort.
328
+ #
329
+ # For the next major version of MIME::Types, this method will become #<=> and
330
+ # #priority_compare will be removed.
331
+ #
332
+ # source://mime-types//lib/mime/type.rb#203
333
+ def priority_compare(other); end
334
+
335
+ # Indicates whether the MIME type's registration with IANA is provisional.
336
+ #
337
+ # :attr_accessor: provisional
338
+ #
339
+ # source://mime-types//lib/mime/type.rb#493
340
+ def provisional; end
341
+
342
+ # source://mime-types//lib/mime/type.rb#496
343
+ def provisional=(value); end
344
+
345
+ # Indicates whether the MIME type's registration with IANA is provisional.
346
+ #
347
+ # @return [Boolean]
348
+ #
349
+ # source://mime-types//lib/mime/type.rb#502
350
+ def provisional?; end
351
+
352
+ # Returns the media type of the unmodified MIME::Type.
353
+ #
354
+ # text/plain => text
355
+ # x-chemical/x-pdb => x-chemical
356
+ # audio/QCELP => audio
357
+ #
358
+ # source://mime-types//lib/mime/type.rb#305
359
+ def raw_media_type; end
360
+
361
+ # Returns the media type of the unmodified MIME::Type.
362
+ #
363
+ # text/plain => plain
364
+ # x-chemical/x-pdb => x-pdb
365
+ # audio/QCELP => qcelp
366
+ #
367
+ # source://mime-types//lib/mime/type.rb#317
368
+ def raw_sub_type; end
369
+
370
+ # Indicates whether the MIME type has been registered with IANA.
371
+ #
372
+ # :attr_accessor: registered
373
+ #
374
+ # source://mime-types//lib/mime/type.rb#481
375
+ def registered; end
376
+
377
+ # source://mime-types//lib/mime/type.rb#485
378
+ def registered=(value); end
379
+
380
+ # Indicates whether the MIME type has been registered with IANA.
381
+ #
382
+ # :attr_accessor: registered
383
+ #
384
+ # source://mime-types//lib/mime/type.rb#481
385
+ def registered?; end
386
+
387
+ # Indicateswhether the MIME type is declared as a signature type.
388
+ #
389
+ # source://mime-types//lib/mime/type.rb#521
390
+ def signature; end
391
+
392
+ # Indicateswhether the MIME type is declared as a signature type.
393
+ #
394
+ # source://mime-types//lib/mime/type.rb#521
395
+ def signature=(_arg0); end
396
+
397
+ # Indicateswhether the MIME type is declared as a signature type.
398
+ #
399
+ # source://mime-types//lib/mime/type.rb#521
400
+ def signature?; end
401
+
402
+ # A simplified form of the MIME content-type string, suitable for
403
+ # case-insensitive comparison, with the content_type converted to lowercase.
404
+ #
405
+ # text/plain => text/plain
406
+ # x-chemical/x-pdb => x-chemical/x-pdb
407
+ # audio/QCELP => audio/qcelp
408
+ #
409
+ # source://mime-types//lib/mime/type.rb#293
410
+ def simplified; end
411
+
412
+ # Returns the sub-type of the simplified MIME::Type.
413
+ #
414
+ # text/plain => plain
415
+ # x-chemical/x-pdb => pdb
416
+ # audio/QCELP => QCELP
417
+ #
418
+ # source://mime-types//lib/mime/type.rb#311
419
+ def sub_type; end
420
+
421
+ # Converts the MIME::Type to a hash. The output of this method can also be
422
+ # used to initialize a MIME::Type.
423
+ #
424
+ # source://mime-types//lib/mime/type.rb#551
425
+ def to_h; end
426
+
427
+ # Converts the MIME::Type to a JSON string.
428
+ #
429
+ # source://mime-types//lib/mime/type.rb#544
430
+ def to_json(*args); end
431
+
432
+ # Returns the MIME::Type as a string.
433
+ #
434
+ # source://mime-types//lib/mime/type.rb#531
435
+ def to_s; end
436
+
437
+ # Returns the MIME::Type as a string for implicit conversions. This allows
438
+ # MIME::Type objects to appear on either side of a comparison.
439
+ #
440
+ # "text/plain" == MIME::Type.new("content-type" => "text/plain")
441
+ #
442
+ # source://mime-types//lib/mime/type.rb#539
443
+ def to_str; end
444
+
445
+ # source://mime-types//lib/mime/type.rb#403
446
+ def use_instead; end
447
+
448
+ # Sets the attribute use_instead
449
+ #
450
+ # @param value the value to set the attribute use_instead to.
451
+ #
452
+ # source://mime-types//lib/mime/type.rb#408
453
+ def use_instead=(_arg0); end
454
+
455
+ # The decoded cross-reference URL list for this MIME::Type.
456
+ #
457
+ # source://mime-types//lib/mime/type.rb#471
458
+ def xref_urls; end
459
+
460
+ # Returns the value of attribute xrefs.
461
+ #
462
+ # source://mime-types//lib/mime/type.rb#463
463
+ def xrefs; end
464
+
465
+ # source://mime-types//lib/mime/type.rb#466
466
+ def xrefs=(xrefs); end
467
+
468
+ private
469
+
470
+ # source://mime-types//lib/mime/type.rb#662
471
+ def clear_sort_priority; end
472
+
473
+ # source://mime-types//lib/mime/type.rb#693
474
+ def content_type=(type_string); end
475
+
476
+ # MRI 2.2 and older do not have a method for string interning,
477
+ # so we simply freeze them for keeping a similar interface
478
+ #
479
+ # source://mime-types//lib/mime/type.rb#710
480
+ def intern_string(string); end
481
+
482
+ # Update the __sort_priority value. Lower numbers sort better, so the
483
+ # bitmapping may seem a little odd. The _best_ sort priority is 0.
484
+ #
485
+ # | bit | meaning | details |
486
+ # | --- | --------------- | --------- |
487
+ # | 7 | obsolete | 1 if true |
488
+ # | 6 | provisional | 1 if true |
489
+ # | 5 | registered | 0 if true |
490
+ # | 4 | complete | 0 if true |
491
+ # | 3 | # of extensions | see below |
492
+ # | 2 | # of extensions | see below |
493
+ # | 1 | # of extensions | see below |
494
+ # | 0 | # of extensions | see below |
495
+ #
496
+ # The # of extensions is marked as the number of extensions subtracted from
497
+ # 16, to a minimum of 0.
498
+ #
499
+ # source://mime-types//lib/mime/type.rb#682
500
+ def update_sort_priority; end
501
+
502
+ # source://mime-types//lib/mime/type.rb#721
503
+ def xref_map(values, helper); end
504
+
505
+ # source://mime-types//lib/mime/type.rb#729
506
+ def xref_url_for_draft(value); end
507
+
508
+ # source://mime-types//lib/mime/type.rb#737
509
+ def xref_url_for_person(value); end
510
+
511
+ # source://mime-types//lib/mime/type.rb#725
512
+ def xref_url_for_rfc(value); end
513
+
514
+ # source://mime-types//lib/mime/type.rb#733
515
+ def xref_url_for_rfc_errata(value); end
516
+
517
+ # source://mime-types//lib/mime/type.rb#741
518
+ def xref_url_for_template(value); end
519
+
520
+ class << self
521
+ # Converts a provided +content_type+ into a translation key suitable for
522
+ # use with the I18n library.
523
+ #
524
+ # source://mime-types//lib/mime/type.rb#629
525
+ def i18n_key(content_type); end
526
+
527
+ # Return a +MatchData+ object of the +content_type+ against pattern of
528
+ # media types.
529
+ #
530
+ # source://mime-types//lib/mime/type.rb#637
531
+ def match(content_type); end
532
+
533
+ # MIME media types are case-insensitive, but are typically presented in a
534
+ # case-preserving format in the type registry. This method converts
535
+ # +content_type+ to lowercase.
536
+ #
537
+ # In previous versions of mime-types, this would also remove any extension
538
+ # prefix (<tt>x-</tt>). This is no longer default behaviour, but may be
539
+ # provided by providing a truth value to +remove_x_prefix+.
540
+ #
541
+ # source://mime-types//lib/mime/type.rb#623
542
+ def simplified(content_type, remove_x_prefix: T.unsafe(nil)); end
543
+
544
+ private
545
+
546
+ # source://mime-types//lib/mime/type.rb#648
547
+ def simplify_matchdata(matchdata, remove_x = T.unsafe(nil), joiner: T.unsafe(nil)); end
548
+ end
549
+ end
550
+
551
+ # source://mime-types//lib/mime/type.rb#111
552
+ MIME::Type::ASCII_ENCODINGS = T.let(T.unsafe(nil), Array)
553
+
554
+ # source://mime-types//lib/mime/type.rb#110
555
+ MIME::Type::BINARY_ENCODINGS = T.let(T.unsafe(nil), Array)
556
+
557
+ # A version of MIME::Type that works hand-in-hand with a MIME::Types::Columnar
558
+ # container to load data by columns.
559
+ #
560
+ # When a field is has not yet been loaded, that data will be loaded for all
561
+ # types in the container before forwarding the message to MIME::Type.
562
+ #
563
+ # More information can be found in MIME::Types::Columnar.
564
+ #
565
+ # MIME::Type::Columnar is *not* intended to be created except by
566
+ # MIME::Types::Columnar containers.
567
+ #
568
+ # source://mime-types//lib/mime/type/columnar.rb#15
569
+ class MIME::Type::Columnar < ::MIME::Type
570
+ # @return [Columnar] a new instance of Columnar
571
+ #
572
+ # source://mime-types//lib/mime/type/columnar.rb#16
573
+ def initialize(container, content_type, extensions); end
574
+
575
+ # source://mime-types//lib/mime/type/columnar.rb#29
576
+ def docs(*args); end
577
+
578
+ # source://mime-types//lib/mime/type/columnar.rb#29
579
+ def docs=(*args); end
580
+
581
+ # source://mime-types//lib/mime/type/columnar.rb#45
582
+ def encode_with(coder); end
583
+
584
+ # source://mime-types//lib/mime/type/columnar.rb#29
585
+ def encoding(*args); end
586
+
587
+ # source://mime-types//lib/mime/type/columnar.rb#29
588
+ def encoding=(*args); end
589
+
590
+ # source://mime-types//lib/mime/type/columnar.rb#29
591
+ def friendly(*args); end
592
+
593
+ # source://mime-types//lib/mime/type/columnar.rb#29
594
+ def obsolete(*args); end
595
+
596
+ # source://mime-types//lib/mime/type/columnar.rb#29
597
+ def obsolete=(*args); end
598
+
599
+ # source://mime-types//lib/mime/type/columnar.rb#29
600
+ def obsolete?(*args); end
601
+
602
+ # source://mime-types//lib/mime/type/columnar.rb#29
603
+ def preferred_extension(*args); end
604
+
605
+ # source://mime-types//lib/mime/type/columnar.rb#29
606
+ def preferred_extension=(*args); end
607
+
608
+ # source://mime-types//lib/mime/type/columnar.rb#29
609
+ def provisional(*args); end
610
+
611
+ # source://mime-types//lib/mime/type/columnar.rb#29
612
+ def provisional=(*args); end
613
+
614
+ # source://mime-types//lib/mime/type/columnar.rb#29
615
+ def provisional?(*args); end
616
+
617
+ # source://mime-types//lib/mime/type/columnar.rb#29
618
+ def registered(*args); end
619
+
620
+ # source://mime-types//lib/mime/type/columnar.rb#29
621
+ def registered=(*args); end
622
+
623
+ # source://mime-types//lib/mime/type/columnar.rb#29
624
+ def registered?(*args); end
625
+
626
+ # source://mime-types//lib/mime/type/columnar.rb#29
627
+ def signature(*args); end
628
+
629
+ # source://mime-types//lib/mime/type/columnar.rb#29
630
+ def signature=(*args); end
631
+
632
+ # source://mime-types//lib/mime/type/columnar.rb#29
633
+ def signature?(*args); end
634
+
635
+ # source://mime-types//lib/mime/type/columnar.rb#56
636
+ def update_sort_priority; end
637
+
638
+ # source://mime-types//lib/mime/type/columnar.rb#29
639
+ def use_instead(*args); end
640
+
641
+ # source://mime-types//lib/mime/type/columnar.rb#29
642
+ def use_instead=(*args); end
643
+
644
+ # source://mime-types//lib/mime/type/columnar.rb#29
645
+ def xref_urls(*args); end
646
+
647
+ # source://mime-types//lib/mime/type/columnar.rb#29
648
+ def xrefs(*args); end
649
+
650
+ # source://mime-types//lib/mime/type/columnar.rb#29
651
+ def xrefs=(*args); end
652
+ end
653
+
654
+ # source://mime-types//lib/mime/type.rb#109
655
+ MIME::Type::I18N_RE = T.let(T.unsafe(nil), Regexp)
656
+
657
+ # Reflects a MIME content-type specification that is not correctly
658
+ # formatted (it is not +type+/+subtype+).
659
+ #
660
+ # source://mime-types//lib/mime/type.rb#72
661
+ class MIME::Type::InvalidContentType < ::ArgumentError
662
+ # :stopdoc:
663
+ #
664
+ # @return [InvalidContentType] a new instance of InvalidContentType
665
+ #
666
+ # source://mime-types//lib/mime/type.rb#74
667
+ def initialize(type_string); end
668
+
669
+ # source://mime-types//lib/mime/type.rb#78
670
+ def to_s; end
671
+ end
672
+
673
+ # Reflects an unsupported MIME encoding.
674
+ #
675
+ # source://mime-types//lib/mime/type.rb#85
676
+ class MIME::Type::InvalidEncoding < ::ArgumentError
677
+ # :stopdoc:
678
+ #
679
+ # @return [InvalidEncoding] a new instance of InvalidEncoding
680
+ #
681
+ # source://mime-types//lib/mime/type.rb#87
682
+ def initialize(encoding); end
683
+
684
+ # source://mime-types//lib/mime/type.rb#91
685
+ def to_s; end
686
+ end
687
+
688
+ # source://mime-types//lib/mime/type.rb#108
689
+ MIME::Type::MEDIA_TYPE_RE = T.let(T.unsafe(nil), Regexp)
690
+
691
+ # The released version of the mime-types library.
692
+ #
693
+ # source://mime-types//lib/mime/types/version.rb#12
694
+ MIME::Type::VERSION = T.let(T.unsafe(nil), String)
695
+
696
+ # MIME::Types is a registry of MIME types. It is both a class (created with
697
+ # MIME::Types.new) and a default registry (loaded automatically or through
698
+ # interactions with MIME::Types.[] and MIME::Types.type_for).
699
+ #
700
+ # == The Default mime-types Registry
701
+ #
702
+ # The default mime-types registry is loaded automatically when the library
703
+ # is required (<tt>require 'mime/types'</tt>), but it may be lazily loaded
704
+ # (loaded on first use) with the use of the environment variable
705
+ # +RUBY_MIME_TYPES_LAZY_LOAD+ having any value other than +false+. The
706
+ # initial startup is about 14× faster (~10 ms vs ~140 ms), but the
707
+ # registry will be loaded at some point in the future.
708
+ #
709
+ # The default mime-types registry can also be loaded from a Marshal cache
710
+ # file specific to the version of MIME::Types being loaded. This will be
711
+ # handled automatically with the use of a file referred to in the
712
+ # environment variable +RUBY_MIME_TYPES_CACHE+. MIME::Types will attempt to
713
+ # load the registry from this cache file (MIME::Type::Cache.load); if it
714
+ # cannot be loaded (because the file does not exist, there is an error, or
715
+ # the data is for a different version of mime-types), the default registry
716
+ # will be loaded from the normal JSON version and then the cache file will
717
+ # be *written* to the location indicated by +RUBY_MIME_TYPES_CACHE+. Cache
718
+ # file loads just over 4½× faster (~30 ms vs ~140 ms).
719
+ # loads.
720
+ #
721
+ # Notes:
722
+ # * The loading of the default registry is *not* atomic; when using a
723
+ # multi-threaded environment, it is recommended that lazy loading is not
724
+ # used and mime-types is loaded as early as possible.
725
+ # * Cache files should be specified per application in a multiprocess
726
+ # environment and should be initialized during deployment or before
727
+ # forking to minimize the chance that the multiple processes will be
728
+ # trying to write to the same cache file at the same time, or that two
729
+ # applications that are on different versions of mime-types would be
730
+ # thrashing the cache.
731
+ # * Unless cache files are preinitialized, the application using the
732
+ # mime-types cache file must have read/write permission to the cache file.
733
+ #
734
+ # == Usage
735
+ # require 'mime/types'
736
+ #
737
+ # plaintext = MIME::Types['text/plain']
738
+ # print plaintext.media_type # => 'text'
739
+ # print plaintext.sub_type # => 'plain'
740
+ #
741
+ # puts plaintext.extensions.join(" ") # => 'asc txt c cc h hh cpp'
742
+ #
743
+ # puts plaintext.encoding # => 8bit
744
+ # puts plaintext.binary? # => false
745
+ # puts plaintext.ascii? # => true
746
+ # puts plaintext.obsolete? # => false
747
+ # puts plaintext.registered? # => true
748
+ # puts plaintext.provisional? # => false
749
+ # puts plaintext == 'text/plain' # => true
750
+ # puts MIME::Type.simplified('x-appl/x-zip') # => 'appl/zip'
751
+ #
752
+ # source://mime-types//lib/mime/types.rb#6
753
+ class MIME::Types
754
+ include ::Enumerable
755
+ extend ::Enumerable
756
+
757
+ # Creates a new MIME::Types registry.
758
+ #
759
+ # @return [Types] a new instance of Types
760
+ #
761
+ # source://mime-types//lib/mime/types.rb#72
762
+ def initialize; end
763
+
764
+ # Returns a list of MIME::Type objects, which may be empty. The optional
765
+ # flag parameters are <tt>:complete</tt> (finds only complete MIME::Type
766
+ # objects) and <tt>:registered</tt> (finds only MIME::Types that are
767
+ # registered). It is possible for multiple matches to be returned for
768
+ # either type (in the example below, 'text/plain' returns two values --
769
+ # one for the general case, and one for VMS systems).
770
+ #
771
+ # puts "\nMIME::Types['text/plain']"
772
+ # MIME::Types['text/plain'].each { |t| puts t.to_a.join(", ") }
773
+ #
774
+ # puts "\nMIME::Types[/^image/, complete: true]"
775
+ # MIME::Types[/^image/, :complete => true].each do |t|
776
+ # puts t.to_a.join(", ")
777
+ # end
778
+ #
779
+ # If multiple type definitions are returned, returns them sorted as
780
+ # follows:
781
+ # 1. Complete definitions sort before incomplete ones;
782
+ # 2. IANA-registered definitions sort before LTSW-recorded
783
+ # definitions.
784
+ # 3. Current definitions sort before obsolete ones;
785
+ # 4. Obsolete definitions with use-instead clauses sort before those
786
+ # without;
787
+ # 5. Obsolete definitions use-instead clauses are compared.
788
+ # 6. Sort on name.
789
+ #
790
+ # source://mime-types//lib/mime/types.rb#122
791
+ def [](type_id, complete: T.unsafe(nil), registered: T.unsafe(nil)); end
792
+
793
+ # @return [Boolean]
794
+ #
795
+ # source://mime-types//lib/mime/types.rb#198
796
+ def __fully_loaded?; end
797
+
798
+ # Add one or more MIME::Type objects to the set of known types. If the
799
+ # type is already known, a warning will be displayed.
800
+ #
801
+ # The last parameter may be the value <tt>:silent</tt> or +true+ which
802
+ # will suppress duplicate MIME type warnings.
803
+ #
804
+ # source://mime-types//lib/mime/types.rb#166
805
+ def add(*types); end
806
+
807
+ # Add a single MIME::Type object to the set of known types. If the +type+ is
808
+ # already known, a warning will be displayed. The +quiet+ parameter may be a
809
+ # truthy value to suppress that warning.
810
+ #
811
+ # source://mime-types//lib/mime/types.rb#187
812
+ def add_type(type, quiet = T.unsafe(nil)); end
813
+
814
+ # Returns the number of known type variants.
815
+ #
816
+ # source://mime-types//lib/mime/types.rb#78
817
+ def count; end
818
+
819
+ # Iterates through the type variants.
820
+ #
821
+ # source://mime-types//lib/mime/types.rb#87
822
+ def each; end
823
+
824
+ # source://mime-types//lib/mime/types.rb#82
825
+ def inspect; end
826
+
827
+ # Return the list of MIME::Types which belongs to the file based on its
828
+ # filename extension. If there is no extension, the filename will be used
829
+ # as the matching criteria on its own.
830
+ #
831
+ # This will always return a merged, flatten, priority sorted, unique array.
832
+ #
833
+ # puts MIME::Types.type_for('citydesk.xml')
834
+ # => [application/xml, text/xml]
835
+ # puts MIME::Types.type_for('citydesk.gif')
836
+ # => [image/gif]
837
+ # puts MIME::Types.type_for(%w(citydesk.xml citydesk.gif))
838
+ # => [application/xml, image/gif, text/xml]
839
+ #
840
+ # source://mime-types//lib/mime/types.rb#148
841
+ def of(filename); end
842
+
843
+ # Return the list of MIME::Types which belongs to the file based on its
844
+ # filename extension. If there is no extension, the filename will be used
845
+ # as the matching criteria on its own.
846
+ #
847
+ # This will always return a merged, flatten, priority sorted, unique array.
848
+ #
849
+ # puts MIME::Types.type_for('citydesk.xml')
850
+ # => [application/xml, text/xml]
851
+ # puts MIME::Types.type_for('citydesk.gif')
852
+ # => [image/gif]
853
+ # puts MIME::Types.type_for(%w(citydesk.xml citydesk.gif))
854
+ # => [application/xml, image/gif, text/xml]
855
+ #
856
+ # source://mime-types//lib/mime/types.rb#148
857
+ def type_for(filename); end
858
+
859
+ private
860
+
861
+ # source://mime-types//lib/mime/types.rb#204
862
+ def add_type_variant!(mime_type); end
863
+
864
+ # source://mime-types//lib/mime/types.rb#214
865
+ def index_extensions!(mime_type); end
866
+
867
+ # source://mime-types//lib/mime/types.rb#224
868
+ def match(pattern); end
869
+
870
+ # source://mime-types//lib/mime/types.rb#218
871
+ def prune_matches(matches, complete, registered); end
872
+
873
+ # source://mime-types//lib/mime/types.rb#208
874
+ def reindex_extensions!(mime_type); end
875
+
876
+ class << self
877
+ # MIME::Types#[] against the default MIME::Types registry.
878
+ #
879
+ # source://mime-types//lib/mime/types/registry.rb#16
880
+ def [](type_id, complete: T.unsafe(nil), registered: T.unsafe(nil)); end
881
+
882
+ # MIME::Types#add against the default MIME::Types registry.
883
+ #
884
+ # source://mime-types//lib/mime/types/registry.rb#41
885
+ def add(*types); end
886
+
887
+ # MIME::Types#count against the default MIME::Types registry.
888
+ #
889
+ # source://mime-types//lib/mime/types/registry.rb#21
890
+ def count; end
891
+
892
+ # Used to mark a method as deprecated in the mime-types interface.
893
+ #
894
+ # source://mime-types//lib/mime/types/deprecations.rb#7
895
+ def deprecated(options = T.unsafe(nil), &block); end
896
+
897
+ # MIME::Types#each against the default MIME::Types registry.
898
+ #
899
+ # source://mime-types//lib/mime/types/registry.rb#26
900
+ def each; end
901
+
902
+ # Configure the MIME::Types logger. This defaults to an instance of a
903
+ # logger that passes messages (unformatted) through to Kernel#warn.
904
+ # :attr_accessor: logger
905
+ #
906
+ # source://mime-types//lib/mime/types/logger.rb#13
907
+ def logger; end
908
+
909
+ # :nodoc
910
+ #
911
+ # source://mime-types//lib/mime/types/logger.rb#16
912
+ def logger=(logger); end
913
+
914
+ # source://mime-types//lib/mime/types/registry.rb#9
915
+ def new(*_arg0); end
916
+
917
+ # MIME::Types#type_for against the default MIME::Types registry.
918
+ #
919
+ # source://mime-types//lib/mime/types/registry.rb#35
920
+ def of(filename); end
921
+
922
+ # MIME::Types#type_for against the default MIME::Types registry.
923
+ #
924
+ # source://mime-types//lib/mime/types/registry.rb#35
925
+ def type_for(filename); end
926
+
927
+ private
928
+
929
+ # @return [Boolean]
930
+ #
931
+ # source://mime-types//lib/mime/types/deprecations.rb#50
932
+ def __deprecation_logged?(message, once); end
933
+
934
+ # source://mime-types//lib/mime/types/registry.rb#77
935
+ def __instances__; end
936
+
937
+ # source://mime-types//lib/mime/types/registry.rb#57
938
+ def __types__; end
939
+
940
+ # @return [Boolean]
941
+ #
942
+ # source://mime-types//lib/mime/types/registry.rb#47
943
+ def lazy_load?; end
944
+
945
+ # source://mime-types//lib/mime/types/registry.rb#67
946
+ def load_default_mime_types(mode = T.unsafe(nil)); end
947
+
948
+ # source://mime-types//lib/mime/types/registry.rb#62
949
+ def load_mode; end
950
+
951
+ # source://mime-types//lib/mime/types/registry.rb#81
952
+ def reindex_extensions(type); end
953
+ end
954
+ end
955
+
956
+ # Caching of MIME::Types registries is advisable if you will be loading
957
+ # the default registry relatively frequently. With the class methods on
958
+ # MIME::Types::Cache, any MIME::Types registry can be marshaled quickly
959
+ # and easily.
960
+ #
961
+ # The cache is invalidated on a per-data-version basis; a cache file for
962
+ # version 3.2015.1118 will not be reused with version 3.2015.1201.
963
+ #
964
+ # source://mime-types//lib/mime/types/cache.rb#3
965
+ class MIME::Types::Cache < ::Struct
966
+ def data; end
967
+ def data=(_); end
968
+ def version; end
969
+ def version=(_); end
970
+
971
+ class << self
972
+ def [](*_arg0); end
973
+ def inspect; end
974
+ def keyword_init?; end
975
+
976
+ # Attempts to load the cache from the file provided as a parameter or in
977
+ # the environment variable +RUBY_MIME_TYPES_CACHE+. Returns +nil+ if the
978
+ # file does not exist, if the file cannot be loaded, or if the data in
979
+ # the cache version is different than this version.
980
+ #
981
+ # source://mime-types//lib/mime/types/cache.rb#17
982
+ def load(cache_file = T.unsafe(nil)); end
983
+
984
+ def members; end
985
+ def new(*_arg0); end
986
+
987
+ # Attempts to save the types provided to the cache file provided.
988
+ #
989
+ # If +types+ is not provided or is +nil+, the cache will contain the
990
+ # current MIME::Types default registry.
991
+ #
992
+ # If +cache_file+ is not provided or is +nil+, the cache will be written
993
+ # to the file specified in the environment variable
994
+ # +RUBY_MIME_TYPES_CACHE+. If there is no cache file specified either
995
+ # directly or through the environment, this method will return +nil+
996
+ #
997
+ # source://mime-types//lib/mime/types/cache.rb#46
998
+ def save(types = T.unsafe(nil), cache_file = T.unsafe(nil)); end
999
+ end
1000
+ end
1001
+
1002
+ # MIME::Types::Columnar is used to extend a MIME::Types container to load data
1003
+ # by columns instead of from JSON or YAML. Column loads of MIME types loaded
1004
+ # through the columnar store are synchronized with a Mutex.
1005
+ #
1006
+ # MIME::Types::Columnar is not intended to be used directly, but will be added
1007
+ # to an instance of MIME::Types when it is loaded with
1008
+ # MIME::Types::Loader#load_columnar.
1009
+ #
1010
+ # source://mime-types//lib/mime/types/_columnar.rb#12
1011
+ module MIME::Types::Columnar
1012
+ # @return [Boolean]
1013
+ #
1014
+ # source://mime-types//lib/mime/types/_columnar.rb#21
1015
+ def __fully_loaded?; end
1016
+
1017
+ # Load the first column data file (type and extensions).
1018
+ #
1019
+ # source://mime-types//lib/mime/types/_columnar.rb#26
1020
+ def load_base_data(path); end
1021
+
1022
+ private
1023
+
1024
+ # source://mime-types//lib/mime/types/_columnar.rb#169
1025
+ def arr(line); end
1026
+
1027
+ # source://mime-types//lib/mime/types/_columnar.rb#136
1028
+ def dict(line, transform: T.unsafe(nil)); end
1029
+
1030
+ # source://mime-types//lib/mime/types/_columnar.rb#165
1031
+ def dict_array(h, k, v); end
1032
+
1033
+ # source://mime-types//lib/mime/types/_columnar.rb#153
1034
+ def dict_extension_priority(h, k, v); end
1035
+
1036
+ # source://mime-types//lib/mime/types/_columnar.rb#70
1037
+ def each_file_byte(name); end
1038
+
1039
+ # source://mime-types//lib/mime/types/_columnar.rb#48
1040
+ def each_file_line(name, lookup = T.unsafe(nil)); end
1041
+
1042
+ # source://mime-types//lib/mime/types/_columnar.rb#181
1043
+ def flag(line); end
1044
+
1045
+ # source://mime-types//lib/mime/types/_columnar.rb#96
1046
+ def load_docs; end
1047
+
1048
+ # source://mime-types//lib/mime/types/_columnar.rb#89
1049
+ def load_encoding; end
1050
+
1051
+ # source://mime-types//lib/mime/types/_columnar.rb#108
1052
+ def load_flags; end
1053
+
1054
+ # source://mime-types//lib/mime/types/_columnar.rb#124
1055
+ def load_friendly; end
1056
+
1057
+ # source://mime-types//lib/mime/types/_columnar.rb#102
1058
+ def load_preferred_extension; end
1059
+
1060
+ # source://mime-types//lib/mime/types/_columnar.rb#130
1061
+ def load_use_instead; end
1062
+
1063
+ # source://mime-types//lib/mime/types/_columnar.rb#118
1064
+ def load_xrefs; end
1065
+
1066
+ # source://mime-types//lib/mime/types/_columnar.rb#177
1067
+ def opt(line); end
1068
+
1069
+ class << self
1070
+ # source://mime-types//lib/mime/types/_columnar.rb#15
1071
+ def extended(obj); end
1072
+ end
1073
+ end
1074
+
1075
+ # source://mime-types//lib/mime/types/_columnar.rb#13
1076
+ MIME::Types::Columnar::LOAD_MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
1077
+
1078
+ # MIME::Types requires a serializable keyed container that returns an empty Set
1079
+ # on a key miss. Hash#default_value cannot be used because, while it traverses
1080
+ # the Marshal format correctly, it will not survive any other serialization
1081
+ # format (plus, a default of a mutable object resuls in a shared mess).
1082
+ # Hash#default_proc cannot be used without a wrapper because it prevents
1083
+ # Marshal serialization (and does not survive the round-trip).
1084
+ #
1085
+ # source://mime-types//lib/mime/types/container.rb#11
1086
+ class MIME::Types::Container
1087
+ # @return [Container] a new instance of Container
1088
+ #
1089
+ # source://mime-types//lib/mime/types/container.rb#12
1090
+ def initialize(hash = T.unsafe(nil)); end
1091
+
1092
+ # source://mime-types//lib/mime/types/container.rb#47
1093
+ def ==(other); end
1094
+
1095
+ # source://mime-types//lib/mime/types/container.rb#17
1096
+ def [](key); end
1097
+
1098
+ # source://mime-types//lib/mime/types/container.rb#21
1099
+ def []=(key, value); end
1100
+
1101
+ # source://mime-types//lib/mime/types/container.rb#91
1102
+ def add(key, value); end
1103
+
1104
+ # source://mime-types//lib/mime/types/container.rb#51
1105
+ def count(*args, &block); end
1106
+
1107
+ # source://mime-types//lib/mime/types/container.rb#61
1108
+ def each(&block); end
1109
+
1110
+ # source://mime-types//lib/mime/types/container.rb#61
1111
+ def each_pair(&block); end
1112
+
1113
+ # source://mime-types//lib/mime/types/container.rb#67
1114
+ def each_value(&block); end
1115
+
1116
+ # @return [Boolean]
1117
+ #
1118
+ # source://mime-types//lib/mime/types/container.rb#71
1119
+ def empty?; end
1120
+
1121
+ # source://mime-types//lib/mime/types/container.rb#103
1122
+ def encode_with(coder); end
1123
+
1124
+ # source://mime-types//lib/mime/types/container.rb#75
1125
+ def flat_map(&block); end
1126
+
1127
+ # source://mime-types//lib/mime/types/container.rb#107
1128
+ def init_with(coder); end
1129
+
1130
+ # source://mime-types//lib/mime/types/container.rb#79
1131
+ def keys; end
1132
+
1133
+ # source://mime-types//lib/mime/types/container.rb#95
1134
+ def marshal_dump; end
1135
+
1136
+ # source://mime-types//lib/mime/types/container.rb#99
1137
+ def marshal_load(hash); end
1138
+
1139
+ # source://mime-types//lib/mime/types/container.rb#31
1140
+ def merge(other); end
1141
+
1142
+ # source://mime-types//lib/mime/types/container.rb#35
1143
+ def merge!(other); end
1144
+
1145
+ # source://mime-types//lib/mime/types/container.rb#87
1146
+ def select(&block); end
1147
+
1148
+ # source://mime-types//lib/mime/types/container.rb#43
1149
+ def to_hash; end
1150
+
1151
+ # source://mime-types//lib/mime/types/container.rb#83
1152
+ def values; end
1153
+
1154
+ protected
1155
+
1156
+ # Returns the value of attribute container.
1157
+ #
1158
+ # source://mime-types//lib/mime/types/container.rb#114
1159
+ def container; end
1160
+
1161
+ # Sets the attribute container
1162
+ #
1163
+ # @param value the value to set the attribute container to.
1164
+ #
1165
+ # source://mime-types//lib/mime/types/container.rb#114
1166
+ def container=(_arg0); end
1167
+
1168
+ # source://mime-types//lib/mime/types/container.rb#116
1169
+ def normalize; end
1170
+ end
1171
+
1172
+ # source://mime-types//lib/mime/types/container.rb#124
1173
+ MIME::Types::Container::EMPTY_SET = T.let(T.unsafe(nil), Set)
1174
+
1175
+ # This class is responsible for initializing the MIME::Types registry from
1176
+ # the data files supplied with the mime-types library.
1177
+ #
1178
+ # The Loader will use one of the following paths:
1179
+ # 1. The +path+ provided in its constructor argument;
1180
+ # 2. The value of ENV["RUBY_MIME_TYPES_DATA"]; or
1181
+ # 3. The value of MIME::Types::Data::PATH.
1182
+ #
1183
+ # When #load is called, the +path+ will be searched recursively for all YAML
1184
+ # (.yml or .yaml) files. By convention, there is one file for each media
1185
+ # type (application.yml, audio.yml, etc.), but this is not required.
1186
+ #
1187
+ # source://mime-types//lib/mime/types/loader.rb#22
1188
+ class MIME::Types::Loader
1189
+ # Creates a Loader object that can be used to load MIME::Types registries
1190
+ # into memory, using YAML, JSON, or Columnar registry format loaders.
1191
+ #
1192
+ # @return [Loader] a new instance of Loader
1193
+ #
1194
+ # source://mime-types//lib/mime/types/loader.rb#31
1195
+ def initialize(path = T.unsafe(nil), container = T.unsafe(nil)); end
1196
+
1197
+ # The MIME::Types container instance that will be loaded. If not provided
1198
+ # at initialization, a new MIME::Types instance will be constructed.
1199
+ #
1200
+ # source://mime-types//lib/mime/types/loader.rb#27
1201
+ def container; end
1202
+
1203
+ # Loads a MIME::Types registry. Loads from JSON files by default
1204
+ # (#load_json).
1205
+ #
1206
+ # This will load from columnar files (#load_columnar) if <tt>columnar:
1207
+ # true</tt> is provided in +options+ and there are columnar files in +path+.
1208
+ #
1209
+ # source://mime-types//lib/mime/types/loader.rb#82
1210
+ def load(options = T.unsafe(nil)); end
1211
+
1212
+ # Loads a MIME::Types registry from columnar files recursively found in
1213
+ # +path+.
1214
+ #
1215
+ # source://mime-types//lib/mime/types/loader.rb#69
1216
+ def load_columnar; end
1217
+
1218
+ # Loads a MIME::Types registry from JSON files (<tt>*.json</tt>)
1219
+ # recursively found in +path+.
1220
+ #
1221
+ # It is expected that the JSON objects will be an array of hash objects.
1222
+ # The JSON format is the registry format for the MIME types registry
1223
+ # shipped with the mime-types library.
1224
+ #
1225
+ # source://mime-types//lib/mime/types/loader.rb#59
1226
+ def load_json; end
1227
+
1228
+ # Loads a MIME::Types registry from YAML files (<tt>*.yml</tt> or
1229
+ # <tt>*.yaml</tt>) recursively found in +path+.
1230
+ #
1231
+ # It is expected that the YAML objects contained within the registry array
1232
+ # will be tagged as <tt>!ruby/object:MIME::Type</tt>.
1233
+ #
1234
+ # Note that the YAML format is about 2½ times *slower* than the JSON format.
1235
+ #
1236
+ # NOTE: The purpose of this format is purely for maintenance reasons.
1237
+ #
1238
+ # source://mime-types//lib/mime/types/loader.rb#46
1239
+ def load_yaml; end
1240
+
1241
+ # The path that will be read for the MIME::Types files.
1242
+ #
1243
+ # source://mime-types//lib/mime/types/loader.rb#24
1244
+ def path; end
1245
+
1246
+ private
1247
+
1248
+ # source://mime-types//lib/mime/types/loader.rb#156
1249
+ def columnar_path; end
1250
+
1251
+ # source://mime-types//lib/mime/types/loader.rb#152
1252
+ def json_path; end
1253
+
1254
+ # source://mime-types//lib/mime/types/loader.rb#148
1255
+ def yaml_path; end
1256
+
1257
+ class << self
1258
+ # Loads the default MIME::Type registry.
1259
+ #
1260
+ # source://mime-types//lib/mime/types/loader.rb#92
1261
+ def load(options = T.unsafe(nil)); end
1262
+
1263
+ # Loads MIME::Types from a single JSON file.
1264
+ #
1265
+ # It is expected that the JSON objects will be an array of hash objects.
1266
+ # The JSON format is the registry format for the MIME types registry
1267
+ # shipped with the mime-types library.
1268
+ #
1269
+ # source://mime-types//lib/mime/types/loader.rb#126
1270
+ def load_from_json(filename); end
1271
+
1272
+ # Loads MIME::Types from a single YAML file.
1273
+ #
1274
+ # It is expected that the YAML objects contained within the registry
1275
+ # array will be tagged as <tt>!ruby/object:MIME::Type</tt>.
1276
+ #
1277
+ # Note that the YAML format is about 2½ times *slower* than the JSON
1278
+ # format.
1279
+ #
1280
+ # NOTE: The purpose of this format is purely for maintenance reasons.
1281
+ #
1282
+ # source://mime-types//lib/mime/types/loader.rb#105
1283
+ def load_from_yaml(filename); end
1284
+
1285
+ private
1286
+
1287
+ # @return [Boolean]
1288
+ #
1289
+ # source://mime-types//lib/mime/types/loader.rb#137
1290
+ def old_yaml?; end
1291
+
1292
+ # source://mime-types//lib/mime/types/loader.rb#133
1293
+ def read_file(filename); end
1294
+ end
1295
+ end
1296
+
1297
+ # source://mime-types//lib/mime/types/logger.rb#46
1298
+ class MIME::Types::NullLogger < ::Logger
1299
+ # @return [NullLogger] a new instance of NullLogger
1300
+ #
1301
+ # source://mime-types//lib/mime/types/logger.rb#47
1302
+ def initialize(*_arg0); end
1303
+
1304
+ # source://mime-types//lib/mime/types/logger.rb#56
1305
+ def <<(_); end
1306
+
1307
+ # source://mime-types//lib/mime/types/logger.rb#62
1308
+ def add(_severity, _message = T.unsafe(nil), _progname = T.unsafe(nil)); end
1309
+
1310
+ # source://mime-types//lib/mime/types/logger.rb#59
1311
+ def close; end
1312
+
1313
+ # source://mime-types//lib/mime/types/logger.rb#52
1314
+ def reopen(_); end
1315
+ end
1316
+
1317
+ # The released version of the mime-types library.
1318
+ #
1319
+ # source://mime-types//lib/mime/types/version.rb#7
1320
+ MIME::Types::VERSION = T.let(T.unsafe(nil), String)
1321
+
1322
+ # source://mime-types//lib/mime/types/logger.rb#26
1323
+ class MIME::Types::WarnLogger < ::Logger
1324
+ # @return [WarnLogger] a new instance of WarnLogger
1325
+ #
1326
+ # source://mime-types//lib/mime/types/logger.rb#39
1327
+ def initialize(*_arg0); end
1328
+ end
1329
+
1330
+ # source://mime-types//lib/mime/types/logger.rb#27
1331
+ class MIME::Types::WarnLogger::WarnLogDevice < ::Logger::LogDevice
1332
+ # @return [WarnLogDevice] a new instance of WarnLogDevice
1333
+ #
1334
+ # source://mime-types//lib/mime/types/logger.rb#28
1335
+ def initialize(*_arg0); end
1336
+
1337
+ # source://mime-types//lib/mime/types/logger.rb#35
1338
+ def close; end
1339
+
1340
+ # source://mime-types//lib/mime/types/logger.rb#31
1341
+ def write(m); end
1342
+ end