Sha256: bfc469f517f4037e0e5c475f32a180cd9d4c5a73c9670cd73c959acf2fc62e10

Contents?: true

Size: 1008 Bytes

Versions: 2

Compression:

Stored size: 1008 Bytes

Contents

require "yaml"

module Ykxutils
  module_function

  def yaml_load_file_compati(yaml_file_path)
    setting = {}
    valid = false
    begin
      setting = YAML.load_file(yaml_file_path, aliases: true)
      valid = true
    rescue ArgumentError
      # p "yaml_load_file_compat 1"
      # p ex.class
      # p ex.inspect
      # p ex.message
      # p ex.backtrace
      # exit#
    rescue StandardError
      # p "yaml_load_file_compat 1-2"
      # p ex.class
      # p ex.inspect
      # p ex.message
      # p ex.backtrace
    end

    if valid != true
      begin
        setting = YAML.load_file(yaml_file_path)
        # valid = true
      rescue ArgumentError
        # p "yaml_load_file_compat 2"
        # p ex.class
        # p ex.inspect
        # p ex.message
        # p ex.backtrace
        #
      rescue StandardError
        # p "yaml_load_file_compat 2-2"
        # p ex.class
        # p ex.inspect
        # p ex.message
        # p ex.backtrace
      end
    end
    setting
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ykxutils-0.1.6 lib/ykxutils/yamlx.rb
ykxutils-0.1.5 lib/ykxutils/yamlx.rb