Module: Lutaml::Store::Format
- Defined in:
- lib/lutaml/store/format.rb,
lib/lutaml/store/format/xml.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, Xml, Yaml, Yamls
Constant Summary
collapse
- FORMATS =
{
yaml: "Yaml",
yamls: "Yamls",
json: "Json",
jsonl: "Jsonl",
marshal: "MarshalFormat",
xml: "Xml"
}.freeze
Class Method Summary
collapse
Class Method Details
.for_extension(ext) ⇒ Object
34
35
36
|
# File 'lib/lutaml/store/format.rb', line 34
def self.for_extension(ext)
extension_map[ext] || extension_map[".#{ext.to_s.sub(/\A\./, "")}"]
end
|
.resolve(format) ⇒ Object
27
28
29
30
31
32
|
# File 'lib/lutaml/store/format.rb', line 27
def self.resolve(format)
entry = FORMATS[format.to_sym]
raise UnsupportedFormatError, "Unknown format: #{format}" unless entry
const_get(entry).new
end
|