protocol-media-registry 0.0.1
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 +7 -0
- data/ext/depend +3 -0
- data/ext/extconf.rb +32 -0
- data/ext/protocol/media/registry/extensions.gperf +1626 -0
- data/ext/protocol/media/registry/extensions.h +8236 -0
- data/ext/protocol/media/registry/native.c +48 -0
- data/ext/protocol/media/registry/records.gperf +3141 -0
- data/ext/protocol/media/registry/records.h +15918 -0
- data/lib/protocol/media/registry/fallback.rb +25 -0
- data/lib/protocol/media/registry/index.rb +26 -0
- data/lib/protocol/media/registry/record.rb +31 -0
- data/lib/protocol/media/registry/records.rb +4759 -0
- data/lib/protocol/media/registry/version.rb +15 -0
- data/lib/protocol/media/registry.rb +48 -0
- data/license.md +21 -0
- data/readme.md +14 -0
- metadata +69 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
require_relative "records"
|
|
7
|
+
|
|
8
|
+
module Protocol
|
|
9
|
+
module Media
|
|
10
|
+
module Registry
|
|
11
|
+
# Pure Ruby fallback for media type lookup.
|
|
12
|
+
module Fallback
|
|
13
|
+
# Look up the raw record for a media type name.
|
|
14
|
+
def self.lookup(name)
|
|
15
|
+
RECORDS[name]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Look up a media type name by filename extension.
|
|
19
|
+
def self.lookup_extension(extension)
|
|
20
|
+
EXTENSIONS[extension]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
require "Protocol_Media_Registry"
|
|
8
|
+
rescue LoadError
|
|
9
|
+
require_relative "fallback"
|
|
10
|
+
|
|
11
|
+
module Protocol
|
|
12
|
+
module Media
|
|
13
|
+
module Registry
|
|
14
|
+
Index = Fallback
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
else
|
|
19
|
+
module Protocol
|
|
20
|
+
module Media
|
|
21
|
+
module Registry
|
|
22
|
+
Index = Native
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2026, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
module Protocol
|
|
7
|
+
module Media
|
|
8
|
+
module Registry
|
|
9
|
+
# A media type and its associated registry metadata.
|
|
10
|
+
class Record
|
|
11
|
+
# @attribute [Protocol::Media::Type] The media type.
|
|
12
|
+
attr_reader :type
|
|
13
|
+
|
|
14
|
+
# @attribute [String | Nil] The conventional transfer encoding.
|
|
15
|
+
attr_reader :encoding
|
|
16
|
+
|
|
17
|
+
# @attribute [Array(String) | Nil] Known filename extensions.
|
|
18
|
+
attr_reader :extensions
|
|
19
|
+
|
|
20
|
+
# @parameter type [Protocol::Media::Type] The media type.
|
|
21
|
+
# @parameter encoding [String | Nil] The conventional transfer encoding.
|
|
22
|
+
# @parameter extensions [Array(String) | Nil] Known filename extensions.
|
|
23
|
+
def initialize(type, encoding: nil, extensions: nil)
|
|
24
|
+
@type = type
|
|
25
|
+
@encoding = encoding
|
|
26
|
+
@extensions = extensions
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|