Class: Jets::Util::Yamler

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/util/yamler.rb

Class Method Summary collapse

Class Method Details

.load(text) ⇒ Object



5
6
7
8
# File 'lib/jets/util/yamler.rb', line 5

def load(text)
  options = RUBY_VERSION.match?(/^3/) ? {aliases: true} : {} # Ruby 3.0.0 deprecates aliases: true
  YAML.load(text, **options)
end

.load_file(path) ⇒ Object



10
11
12
13
# File 'lib/jets/util/yamler.rb', line 10

def load_file(path)
  options = RUBY_VERSION.match?(/^3/) ? {aliases: true} : {} # Ruby 3.0.0 deprecates aliases: true
  YAML.load_file(path, **options)
end