Module: Lutaml::Model::Toml

Defined in:
lib/lutaml/model/toml.rb

Constant Summary collapse

Document =
::Lutaml::Toml::Adapter::Document
Mapping =
::Lutaml::Toml::Adapter::Mapping
MappingRule =
::Lutaml::Toml::Adapter::MappingRule
Transform =
::Lutaml::Toml::Adapter::Transform

Class Method Summary collapse

Class Method Details

.detect_toml_adapterObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lutaml/model/toml.rb', line 18

def self.detect_toml_adapter
  return nil if Lutaml::Model::RuntimeCompatibility.opal?

  # Skip tomlib on Windows entirely due to segfault issues
  if Lutaml::Model::RuntimeCompatibility.windows?
    return :toml_rb if Lutaml::Model::Utils.safe_load("toml-rb", :TomlRb)

    return nil
  end

  # On non-Windows, prefer tomlib
  return :tomlib if Lutaml::Model::Utils.safe_load("tomlib", :Tomlib)
  return :toml_rb if Lutaml::Model::Utils.safe_load("toml-rb", :TomlRb)

  nil
end