Module: Lutaml::Store::Format
- Defined in:
- lib/lutaml/store/format.rb,
lib/lutaml/store/format/base.rb,
lib/lutaml/store/format/json.rb,
lib/lutaml/store/format/yaml.rb,
lib/lutaml/store/format/jsonl.rb,
lib/lutaml/store/format/yamls.rb,
lib/lutaml/store/format/marshal_format.rb
Defined Under Namespace
Classes: Base, Error, FormatError, Json, Jsonl, MarshalFormat, UnsupportedFormatError, Yaml, Yamls
Constant Summary
collapse
- FORMATS =
{
yaml: "Yaml",
yamls: "Yamls",
json: "Json",
jsonl: "Jsonl",
marshal: "MarshalFormat"
}.freeze
Class Method Summary
collapse
Class Method Details
.for_extension(ext) ⇒ Object
32
33
34
|
# File 'lib/lutaml/store/format.rb', line 32
def self.for_extension(ext)
extension_map[ext] || extension_map[".#{ext.to_s.sub(/\A\./, "")}"]
end
|
.resolve(format) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/lutaml/store/format.rb', line 25
def self.resolve(format)
entry = FORMATS[format.to_sym]
raise UnsupportedFormatError, "Unknown format: #{format}" unless entry
const_get(entry).new
end
|