roast-ai 0.4.8 → 0.4.10
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/Gemfile +6 -7
- data/Gemfile.lock +15 -3
- data/README.md +9 -5
- data/dsl/demo/Gemfile +4 -0
- data/dsl/demo/Gemfile.lock +120 -0
- data/dsl/demo/cogs/local.rb +15 -0
- data/dsl/demo/simple_external_cog.rb +17 -0
- data/dsl/less_simple.rb +112 -0
- data/dsl/plugin-gem-example/.gitignore +8 -0
- data/dsl/plugin-gem-example/Gemfile +13 -0
- data/dsl/plugin-gem-example/Gemfile.lock +178 -0
- data/dsl/plugin-gem-example/lib/other.rb +17 -0
- data/dsl/plugin-gem-example/lib/plugin_gem_example.rb +5 -0
- data/dsl/plugin-gem-example/lib/simple.rb +15 -0
- data/dsl/plugin-gem-example/lib/version.rb +10 -0
- data/dsl/plugin-gem-example/plugin-gem-example.gemspec +28 -0
- data/dsl/prototype.rb +25 -0
- data/dsl/scoped_executors.rb +28 -0
- data/dsl/simple.rb +5 -7
- data/dsl/simple_chat.rb +12 -0
- data/dsl/step_communication.rb +24 -0
- data/examples/grading/README.md +46 -0
- data/examples/grading/analyze_coverage/prompt.md +52 -0
- data/examples/grading/calculate_final_grade.rb +64 -0
- data/examples/grading/format_result.rb +61 -0
- data/examples/grading/generate_grades/prompt.md +105 -0
- data/examples/grading/generate_recommendations/output.txt +17 -0
- data/examples/grading/generate_recommendations/prompt.md +60 -0
- data/examples/grading/read_dependencies/prompt.md +15 -0
- data/examples/grading/verify_mocks_and_stubs/prompt.md +12 -0
- data/examples/grading/verify_test_helpers/prompt.md +53 -0
- data/examples/grading/workflow.md +5 -0
- data/examples/grading/workflow.yml +28 -0
- data/lib/roast/dsl/cog/config.rb +36 -0
- data/lib/roast/dsl/cog/input.rb +30 -0
- data/lib/roast/dsl/cog/output.rb +24 -0
- data/lib/roast/dsl/cog/registry.rb +39 -0
- data/lib/roast/dsl/cog/stack.rb +22 -0
- data/lib/roast/dsl/cog/store.rb +29 -0
- data/lib/roast/dsl/cog.rb +91 -0
- data/lib/roast/dsl/cog_input_context.rb +9 -0
- data/lib/roast/dsl/cog_input_manager.rb +47 -0
- data/lib/roast/dsl/cogs/chat.rb +78 -0
- data/lib/roast/dsl/cogs/cmd.rb +132 -0
- data/lib/roast/dsl/cogs/execute.rb +46 -0
- data/lib/roast/dsl/cogs/graph.rb +53 -0
- data/lib/roast/dsl/config_context.rb +9 -0
- data/lib/roast/dsl/config_manager.rb +96 -0
- data/lib/roast/dsl/execution_context.rb +9 -0
- data/lib/roast/dsl/execution_manager.rb +137 -0
- data/lib/roast/dsl/workflow.rb +113 -0
- data/lib/roast/error.rb +7 -0
- data/lib/roast/errors.rb +3 -3
- data/lib/roast/graph/edge.rb +25 -0
- data/lib/roast/graph/node.rb +40 -0
- data/lib/roast/graph/quantum_edge.rb +27 -0
- data/lib/roast/graph/threaded_exec.rb +93 -0
- data/lib/roast/graph.rb +233 -0
- data/lib/roast/resources/api_resource.rb +2 -2
- data/lib/roast/resources/url_resource.rb +2 -2
- data/lib/roast/tools/apply_diff.rb +1 -1
- data/lib/roast/tools/ask_user.rb +1 -1
- data/lib/roast/tools/bash.rb +1 -1
- data/lib/roast/tools/cmd.rb +2 -2
- data/lib/roast/tools/coding_agent.rb +2 -2
- data/lib/roast/tools/grep.rb +1 -1
- data/lib/roast/tools/read_file.rb +1 -1
- data/lib/roast/tools/search_file.rb +1 -1
- data/lib/roast/tools/swarm.rb +1 -1
- data/lib/roast/tools/update_files.rb +2 -2
- data/lib/roast/tools/write_file.rb +1 -1
- data/lib/roast/tools.rb +1 -1
- data/lib/roast/value_objects/api_token.rb +1 -1
- data/lib/roast/value_objects/uri_base.rb +1 -1
- data/lib/roast/value_objects/workflow_path.rb +1 -1
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/base_workflow.rb +38 -2
- data/lib/roast/workflow/command_executor.rb +1 -1
- data/lib/roast/workflow/configuration_loader.rb +1 -1
- data/lib/roast/workflow/error_handler.rb +1 -1
- data/lib/roast/workflow/step_executor_registry.rb +1 -1
- data/lib/roast/workflow/step_loader.rb +1 -1
- data/lib/roast/workflow/workflow_executor.rb +1 -1
- data/lib/roast.rb +4 -3
- data/roast.gemspec +1 -0
- data/sorbet/config +3 -0
- data/sorbet/rbi/annotations/.gitattributes +1 -0
- data/sorbet/rbi/annotations/activesupport.rbi +495 -0
- data/sorbet/rbi/annotations/faraday.rbi +17 -0
- data/sorbet/rbi/annotations/minitest.rbi +119 -0
- data/sorbet/rbi/annotations/mocha.rbi +34 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/annotations/webmock.rbi +9 -0
- data/sorbet/rbi/gems/marcel@1.1.0.rbi +239 -0
- data/sorbet/rbi/gems/{rack@2.2.17.rbi → rack@2.2.19.rbi} +55 -38
- data/sorbet/rbi/gems/{rexml@3.4.1.rbi → rexml@3.4.2.rbi} +284 -239
- data/sorbet/rbi/gems/ruby_llm@1.8.2.rbi +5703 -0
- data/sorbet/rbi/shims/lib/roast/dsl/cog_input_context.rbi +17 -0
- data/sorbet/rbi/shims/lib/roast/dsl/config_context.rbi +17 -0
- data/sorbet/rbi/shims/lib/roast/dsl/execution_context.rbi +17 -0
- data/sorbet/rbi/todo.rbi +7 -0
- metadata +84 -6
- data/lib/roast/dsl/executor.rb +0 -27
- data/package-lock.json +0 -6
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This file was pulled from a central RBI files repository.
|
|
5
|
+
# Please run `bin/tapioca annotations` to update it.
|
|
6
|
+
|
|
7
|
+
module Rainbow
|
|
8
|
+
# @shim: https://github.com/sickill/rainbow/blob/master/lib/rainbow.rb#L10-L12
|
|
9
|
+
sig { returns(T::Boolean) }
|
|
10
|
+
attr_accessor :enabled
|
|
11
|
+
|
|
12
|
+
class Color
|
|
13
|
+
sig { returns(Symbol) }
|
|
14
|
+
attr_reader :ground
|
|
15
|
+
|
|
16
|
+
sig { params(ground: Symbol, values: T.any([Integer], [Integer, Integer, Integer])).returns(Color) }
|
|
17
|
+
def self.build(ground, values); end
|
|
18
|
+
|
|
19
|
+
sig { params(hex: String).returns([Integer, Integer, Integer]) }
|
|
20
|
+
def self.parse_hex_color(hex); end
|
|
21
|
+
|
|
22
|
+
class Indexed < Rainbow::Color
|
|
23
|
+
sig { returns(Integer) }
|
|
24
|
+
attr_reader :num
|
|
25
|
+
|
|
26
|
+
sig { params(ground: Symbol, num: Integer).void }
|
|
27
|
+
def initialize(ground, num); end
|
|
28
|
+
|
|
29
|
+
sig { returns(T::Array[Integer]) }
|
|
30
|
+
def codes; end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class Named < Rainbow::Color::Indexed
|
|
34
|
+
NAMES = T.let(nil, T::Hash[Symbol, Integer])
|
|
35
|
+
|
|
36
|
+
sig { params(ground: Symbol, name: Symbol).void }
|
|
37
|
+
def initialize(ground, name); end
|
|
38
|
+
|
|
39
|
+
sig { returns(T::Array[Symbol]) }
|
|
40
|
+
def self.color_names; end
|
|
41
|
+
|
|
42
|
+
sig { returns(String) }
|
|
43
|
+
def self.valid_names; end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class RGB < Rainbow::Color::Indexed
|
|
47
|
+
sig { returns(Integer) }
|
|
48
|
+
attr_reader :r, :g, :b
|
|
49
|
+
|
|
50
|
+
sig { params(ground: Symbol, values: Integer).void }
|
|
51
|
+
def initialize(ground, *values); end
|
|
52
|
+
|
|
53
|
+
sig { returns(T::Array[Integer]) }
|
|
54
|
+
def codes; end
|
|
55
|
+
|
|
56
|
+
sig { params(value: Numeric).returns(Integer) }
|
|
57
|
+
def self.to_ansi_domain(value); end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
class X11Named < Rainbow::Color::RGB
|
|
61
|
+
include Rainbow::X11ColorNames
|
|
62
|
+
|
|
63
|
+
sig { params(ground: Symbol, name: Symbol).void }
|
|
64
|
+
def initialize(ground, name); end
|
|
65
|
+
|
|
66
|
+
sig { returns(T::Array[Symbol]) }
|
|
67
|
+
def self.color_names; end
|
|
68
|
+
|
|
69
|
+
sig { returns(String) }
|
|
70
|
+
def self.valid_names; end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
sig { returns(Wrapper) }
|
|
75
|
+
def self.global; end
|
|
76
|
+
|
|
77
|
+
sig { returns(T::Boolean) }
|
|
78
|
+
def self.enabled; end
|
|
79
|
+
|
|
80
|
+
sig { params(value: T::Boolean).returns(T::Boolean) }
|
|
81
|
+
def self.enabled=(value); end
|
|
82
|
+
|
|
83
|
+
sig { params(string: String).returns(String) }
|
|
84
|
+
def self.uncolor(string); end
|
|
85
|
+
|
|
86
|
+
class NullPresenter < String
|
|
87
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
|
|
88
|
+
def color(*values); end
|
|
89
|
+
|
|
90
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
|
|
91
|
+
def foreground(*values); end
|
|
92
|
+
|
|
93
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
|
|
94
|
+
def fg(*values); end
|
|
95
|
+
|
|
96
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
|
|
97
|
+
def background(*values); end
|
|
98
|
+
|
|
99
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
|
|
100
|
+
def bg(*values); end
|
|
101
|
+
|
|
102
|
+
sig { returns(NullPresenter) }
|
|
103
|
+
def reset; end
|
|
104
|
+
|
|
105
|
+
sig { returns(NullPresenter) }
|
|
106
|
+
def bright; end
|
|
107
|
+
|
|
108
|
+
sig { returns(NullPresenter) }
|
|
109
|
+
def faint; end
|
|
110
|
+
|
|
111
|
+
sig { returns(NullPresenter) }
|
|
112
|
+
def italic; end
|
|
113
|
+
|
|
114
|
+
sig { returns(NullPresenter) }
|
|
115
|
+
def underline; end
|
|
116
|
+
|
|
117
|
+
sig { returns(NullPresenter) }
|
|
118
|
+
def blink; end
|
|
119
|
+
|
|
120
|
+
sig { returns(NullPresenter) }
|
|
121
|
+
def inverse; end
|
|
122
|
+
|
|
123
|
+
sig { returns(NullPresenter) }
|
|
124
|
+
def hide; end
|
|
125
|
+
|
|
126
|
+
sig { returns(NullPresenter) }
|
|
127
|
+
def cross_out; end
|
|
128
|
+
|
|
129
|
+
sig { returns(NullPresenter) }
|
|
130
|
+
def black; end
|
|
131
|
+
|
|
132
|
+
sig { returns(NullPresenter) }
|
|
133
|
+
def red; end
|
|
134
|
+
|
|
135
|
+
sig { returns(NullPresenter) }
|
|
136
|
+
def green; end
|
|
137
|
+
|
|
138
|
+
sig { returns(NullPresenter) }
|
|
139
|
+
def yellow; end
|
|
140
|
+
|
|
141
|
+
sig { returns(NullPresenter) }
|
|
142
|
+
def blue; end
|
|
143
|
+
|
|
144
|
+
sig { returns(NullPresenter) }
|
|
145
|
+
def magenta; end
|
|
146
|
+
|
|
147
|
+
sig { returns(NullPresenter) }
|
|
148
|
+
def cyan; end
|
|
149
|
+
|
|
150
|
+
sig { returns(NullPresenter) }
|
|
151
|
+
def white; end
|
|
152
|
+
|
|
153
|
+
sig { returns(NullPresenter) }
|
|
154
|
+
def bold; end
|
|
155
|
+
|
|
156
|
+
sig { returns(NullPresenter) }
|
|
157
|
+
def dark; end
|
|
158
|
+
|
|
159
|
+
sig { returns(NullPresenter) }
|
|
160
|
+
def strike; end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
class Presenter < String
|
|
164
|
+
TERM_EFFECTS = T.let(nil, T::Hash[Symbol, Integer])
|
|
165
|
+
|
|
166
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
|
|
167
|
+
def color(*values); end
|
|
168
|
+
|
|
169
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
|
|
170
|
+
def foreground(*values); end
|
|
171
|
+
|
|
172
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
|
|
173
|
+
def fg(*values); end
|
|
174
|
+
|
|
175
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
|
|
176
|
+
def background(*values); end
|
|
177
|
+
|
|
178
|
+
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
|
|
179
|
+
def bg(*values); end
|
|
180
|
+
|
|
181
|
+
sig { returns(Presenter) }
|
|
182
|
+
def reset; end
|
|
183
|
+
|
|
184
|
+
sig { returns(Presenter) }
|
|
185
|
+
def bright; end
|
|
186
|
+
|
|
187
|
+
sig { returns(Presenter) }
|
|
188
|
+
def faint; end
|
|
189
|
+
|
|
190
|
+
sig { returns(Presenter) }
|
|
191
|
+
def italic; end
|
|
192
|
+
|
|
193
|
+
sig { returns(Presenter) }
|
|
194
|
+
def underline; end
|
|
195
|
+
|
|
196
|
+
sig { returns(Presenter) }
|
|
197
|
+
def blink; end
|
|
198
|
+
|
|
199
|
+
sig { returns(Presenter) }
|
|
200
|
+
def inverse; end
|
|
201
|
+
|
|
202
|
+
sig { returns(Presenter) }
|
|
203
|
+
def hide; end
|
|
204
|
+
|
|
205
|
+
sig { returns(Presenter) }
|
|
206
|
+
def cross_out; end
|
|
207
|
+
|
|
208
|
+
sig { returns(Presenter) }
|
|
209
|
+
def black; end
|
|
210
|
+
|
|
211
|
+
sig { returns(Presenter) }
|
|
212
|
+
def red; end
|
|
213
|
+
|
|
214
|
+
sig { returns(Presenter) }
|
|
215
|
+
def green; end
|
|
216
|
+
|
|
217
|
+
sig { returns(Presenter) }
|
|
218
|
+
def yellow; end
|
|
219
|
+
|
|
220
|
+
sig { returns(Presenter) }
|
|
221
|
+
def blue; end
|
|
222
|
+
|
|
223
|
+
sig { returns(Presenter) }
|
|
224
|
+
def magenta; end
|
|
225
|
+
|
|
226
|
+
sig { returns(Presenter) }
|
|
227
|
+
def cyan; end
|
|
228
|
+
|
|
229
|
+
sig { returns(Presenter) }
|
|
230
|
+
def white; end
|
|
231
|
+
|
|
232
|
+
sig { returns(Presenter) }
|
|
233
|
+
def bold; end
|
|
234
|
+
|
|
235
|
+
sig { returns(Presenter) }
|
|
236
|
+
def dark; end
|
|
237
|
+
|
|
238
|
+
sig { returns(Presenter) }
|
|
239
|
+
def strike; end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
class StringUtils
|
|
243
|
+
sig { params(string: String, codes: T::Array[Integer]).returns(String) }
|
|
244
|
+
def self.wrap_with_sgr(string, codes); end
|
|
245
|
+
|
|
246
|
+
sig { params(string: String).returns(String) }
|
|
247
|
+
def self.uncolor(string); end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
VERSION = T.let(nil, String)
|
|
251
|
+
|
|
252
|
+
class Wrapper
|
|
253
|
+
sig { returns(T::Boolean) }
|
|
254
|
+
attr_accessor :enabled
|
|
255
|
+
|
|
256
|
+
sig { params(enabled: T::Boolean).void }
|
|
257
|
+
def initialize(enabled = true); end
|
|
258
|
+
|
|
259
|
+
sig { params(string: String).returns(T.any(Rainbow::Presenter, Rainbow::NullPresenter)) }
|
|
260
|
+
def wrap(string); end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
module X11ColorNames
|
|
264
|
+
NAMES = T.let(nil, T::Hash[Symbol, [Integer, Integer, Integer]])
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
sig { params(string: String).returns(Rainbow::Presenter) }
|
|
269
|
+
def Rainbow(string); end
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
# DO NOT EDIT MANUALLY
|
|
4
|
+
# This is an autogenerated file for types exported from the `marcel` gem.
|
|
5
|
+
# Please instead update this file by running `bin/tapioca gem marcel`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# This file is auto-generated. Instead of editing this file, please
|
|
9
|
+
# add MIMEs to data/custom.xml or lib/marcel/mime_type/definitions.rb.
|
|
10
|
+
#
|
|
11
|
+
# source://marcel//lib/marcel.rb#3
|
|
12
|
+
module Marcel; end
|
|
13
|
+
|
|
14
|
+
# @private
|
|
15
|
+
#
|
|
16
|
+
# source://marcel//lib/marcel/tables.rb#9
|
|
17
|
+
Marcel::EXTENSIONS = T.let(T.unsafe(nil), Hash)
|
|
18
|
+
|
|
19
|
+
# @private
|
|
20
|
+
#
|
|
21
|
+
# source://marcel//lib/marcel/tables.rb#2513
|
|
22
|
+
Marcel::MAGIC = T.let(T.unsafe(nil), Array)
|
|
23
|
+
|
|
24
|
+
# Mime type detection
|
|
25
|
+
#
|
|
26
|
+
# source://marcel//lib/marcel/magic.rb#12
|
|
27
|
+
class Marcel::Magic
|
|
28
|
+
# Mime type by type string
|
|
29
|
+
#
|
|
30
|
+
# @return [Magic] a new instance of Magic
|
|
31
|
+
#
|
|
32
|
+
# source://marcel//lib/marcel/magic.rb#16
|
|
33
|
+
def initialize(type); end
|
|
34
|
+
|
|
35
|
+
# Allow comparison with string
|
|
36
|
+
#
|
|
37
|
+
# @return [Boolean]
|
|
38
|
+
#
|
|
39
|
+
# source://marcel//lib/marcel/magic.rb#103
|
|
40
|
+
def ==(other); end
|
|
41
|
+
|
|
42
|
+
# @return [Boolean]
|
|
43
|
+
#
|
|
44
|
+
# source://marcel//lib/marcel/magic.rb#54
|
|
45
|
+
def audio?; end
|
|
46
|
+
|
|
47
|
+
# Returns true if type is child of parent type
|
|
48
|
+
#
|
|
49
|
+
# @return [Boolean]
|
|
50
|
+
#
|
|
51
|
+
# source://marcel//lib/marcel/magic.rb#58
|
|
52
|
+
def child_of?(parent); end
|
|
53
|
+
|
|
54
|
+
# Get mime comment
|
|
55
|
+
#
|
|
56
|
+
# source://marcel//lib/marcel/magic.rb#68
|
|
57
|
+
def comment; end
|
|
58
|
+
|
|
59
|
+
# Allow comparison with string
|
|
60
|
+
#
|
|
61
|
+
# @return [Boolean]
|
|
62
|
+
#
|
|
63
|
+
# source://marcel//lib/marcel/magic.rb#103
|
|
64
|
+
def eql?(other); end
|
|
65
|
+
|
|
66
|
+
# Get string list of file extensions
|
|
67
|
+
#
|
|
68
|
+
# source://marcel//lib/marcel/magic.rb#63
|
|
69
|
+
def extensions; end
|
|
70
|
+
|
|
71
|
+
# source://marcel//lib/marcel/magic.rb#107
|
|
72
|
+
def hash; end
|
|
73
|
+
|
|
74
|
+
# Mediatype shortcuts
|
|
75
|
+
#
|
|
76
|
+
# @return [Boolean]
|
|
77
|
+
#
|
|
78
|
+
# source://marcel//lib/marcel/magic.rb#53
|
|
79
|
+
def image?; end
|
|
80
|
+
|
|
81
|
+
# Returns the value of attribute mediatype.
|
|
82
|
+
#
|
|
83
|
+
# source://marcel//lib/marcel/magic.rb#13
|
|
84
|
+
def mediatype; end
|
|
85
|
+
|
|
86
|
+
# Returns the value of attribute subtype.
|
|
87
|
+
#
|
|
88
|
+
# source://marcel//lib/marcel/magic.rb#13
|
|
89
|
+
def subtype; end
|
|
90
|
+
|
|
91
|
+
# Returns true if type is a text format
|
|
92
|
+
#
|
|
93
|
+
# @return [Boolean]
|
|
94
|
+
#
|
|
95
|
+
# source://marcel//lib/marcel/magic.rb#50
|
|
96
|
+
def text?; end
|
|
97
|
+
|
|
98
|
+
# Return type as string
|
|
99
|
+
#
|
|
100
|
+
# source://marcel//lib/marcel/magic.rb#98
|
|
101
|
+
def to_s; end
|
|
102
|
+
|
|
103
|
+
# Returns the value of attribute type.
|
|
104
|
+
#
|
|
105
|
+
# source://marcel//lib/marcel/magic.rb#13
|
|
106
|
+
def type; end
|
|
107
|
+
|
|
108
|
+
# @return [Boolean]
|
|
109
|
+
#
|
|
110
|
+
# source://marcel//lib/marcel/magic.rb#55
|
|
111
|
+
def video?; end
|
|
112
|
+
|
|
113
|
+
class << self
|
|
114
|
+
# Add custom mime type. Arguments:
|
|
115
|
+
# * <i>type</i>: Mime type
|
|
116
|
+
# * <i>options</i>: Options hash
|
|
117
|
+
#
|
|
118
|
+
# Option keys:
|
|
119
|
+
# * <i>:extensions</i>: String list or single string of file extensions
|
|
120
|
+
# * <i>:parents</i>: String list or single string of parent mime types
|
|
121
|
+
# * <i>:magic</i>: Mime magic specification
|
|
122
|
+
# * <i>:comment</i>: Comment string
|
|
123
|
+
#
|
|
124
|
+
# source://marcel//lib/marcel/magic.rb#30
|
|
125
|
+
def add(type, options); end
|
|
126
|
+
|
|
127
|
+
# Lookup all mime types by magic content analysis.
|
|
128
|
+
# This is a slower operation.
|
|
129
|
+
#
|
|
130
|
+
# source://marcel//lib/marcel/magic.rb#93
|
|
131
|
+
def all_by_magic(io); end
|
|
132
|
+
|
|
133
|
+
# Lookup mime type by file extension
|
|
134
|
+
#
|
|
135
|
+
# source://marcel//lib/marcel/magic.rb#73
|
|
136
|
+
def by_extension(ext); end
|
|
137
|
+
|
|
138
|
+
# Lookup mime type by magic content analysis.
|
|
139
|
+
# This is a slow operation.
|
|
140
|
+
#
|
|
141
|
+
# source://marcel//lib/marcel/magic.rb#86
|
|
142
|
+
def by_magic(io); end
|
|
143
|
+
|
|
144
|
+
# Lookup mime type by filename
|
|
145
|
+
#
|
|
146
|
+
# source://marcel//lib/marcel/magic.rb#80
|
|
147
|
+
def by_path(path); end
|
|
148
|
+
|
|
149
|
+
# @return [Boolean]
|
|
150
|
+
#
|
|
151
|
+
# source://marcel//lib/marcel/magic.rb#113
|
|
152
|
+
def child?(child, parent); end
|
|
153
|
+
|
|
154
|
+
# Removes a mime type from the dictionary. You might want to do this if
|
|
155
|
+
# you're seeing impossible conflicts (for instance, application/x-gmc-link).
|
|
156
|
+
# * <i>type</i>: The mime type to remove. All associated extensions and magic are removed too.
|
|
157
|
+
#
|
|
158
|
+
# source://marcel//lib/marcel/magic.rb#42
|
|
159
|
+
def remove(type); end
|
|
160
|
+
|
|
161
|
+
private
|
|
162
|
+
|
|
163
|
+
# source://marcel//lib/marcel/magic.rb#117
|
|
164
|
+
def magic_match(io, method); end
|
|
165
|
+
|
|
166
|
+
# source://marcel//lib/marcel/magic.rb#127
|
|
167
|
+
def magic_match_io(io, matches, buffer); end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# source://marcel//lib/marcel/mime_type.rb#4
|
|
172
|
+
class Marcel::MimeType
|
|
173
|
+
class << self
|
|
174
|
+
# source://marcel//lib/marcel/mime_type.rb#8
|
|
175
|
+
def extend(type, extensions: T.unsafe(nil), parents: T.unsafe(nil), magic: T.unsafe(nil)); end
|
|
176
|
+
|
|
177
|
+
# Returns the most appropriate content type for the given file.
|
|
178
|
+
#
|
|
179
|
+
# The first argument should be a +Pathname+ or an +IO+. If it is a +Pathname+, the specified
|
|
180
|
+
# file will be opened first.
|
|
181
|
+
#
|
|
182
|
+
# Optional parameters:
|
|
183
|
+
# * +name+: file name, if known
|
|
184
|
+
# * +extension+: file extension, if known
|
|
185
|
+
# * +declared_type+: MIME type, if known
|
|
186
|
+
#
|
|
187
|
+
# The most appropriate type is determined by the following:
|
|
188
|
+
# * type declared by binary magic number data
|
|
189
|
+
# * type declared by the first of file name, file extension, or declared MIME type
|
|
190
|
+
#
|
|
191
|
+
# If no type can be determined, then +application/octet-stream+ is returned.
|
|
192
|
+
#
|
|
193
|
+
# source://marcel//lib/marcel/mime_type.rb#29
|
|
194
|
+
def for(pathname_or_io = T.unsafe(nil), name: T.unsafe(nil), extension: T.unsafe(nil), declared_type: T.unsafe(nil)); end
|
|
195
|
+
|
|
196
|
+
private
|
|
197
|
+
|
|
198
|
+
# source://marcel//lib/marcel/mime_type.rb#36
|
|
199
|
+
def for_data(pathname_or_io); end
|
|
200
|
+
|
|
201
|
+
# source://marcel//lib/marcel/mime_type.rb#62
|
|
202
|
+
def for_declared_type(declared_type); end
|
|
203
|
+
|
|
204
|
+
# source://marcel//lib/marcel/mime_type.rb#54
|
|
205
|
+
def for_extension(extension); end
|
|
206
|
+
|
|
207
|
+
# source://marcel//lib/marcel/mime_type.rb#46
|
|
208
|
+
def for_name(name); end
|
|
209
|
+
|
|
210
|
+
# For some document types (notably Microsoft Office) we recognise the main content
|
|
211
|
+
# type with magic, but not the specific subclass. In this situation, if we can get a more
|
|
212
|
+
# specific class using either the name or declared_type, we should use that in preference
|
|
213
|
+
#
|
|
214
|
+
# source://marcel//lib/marcel/mime_type.rb#89
|
|
215
|
+
def most_specific_type(*candidates); end
|
|
216
|
+
|
|
217
|
+
# source://marcel//lib/marcel/mime_type.rb#79
|
|
218
|
+
def parse_media_type(content_type); end
|
|
219
|
+
|
|
220
|
+
# source://marcel//lib/marcel/mime_type.rb#71
|
|
221
|
+
def with_io(pathname_or_io, &block); end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# source://marcel//lib/marcel/mime_type.rb#5
|
|
226
|
+
Marcel::MimeType::BINARY = T.let(T.unsafe(nil), String)
|
|
227
|
+
|
|
228
|
+
# @private
|
|
229
|
+
#
|
|
230
|
+
# source://marcel//lib/marcel/tables.rb#1310
|
|
231
|
+
Marcel::TYPE_EXTS = T.let(T.unsafe(nil), Hash)
|
|
232
|
+
|
|
233
|
+
# Cooltalk Audio
|
|
234
|
+
#
|
|
235
|
+
# source://marcel//lib/marcel/tables.rb#2239
|
|
236
|
+
Marcel::TYPE_PARENTS = T.let(T.unsafe(nil), Hash)
|
|
237
|
+
|
|
238
|
+
# source://marcel//lib/marcel/version.rb#4
|
|
239
|
+
Marcel::VERSION = T.let(T.unsafe(nil), String)
|