Sha256: f7a037fe679d6e1df923693a9221a305fce92df337a4b6c4abd51ba19d4bdfc3
Contents?: true
Size: 619 Bytes
Versions: 2
Compression:
Stored size: 619 Bytes
Contents
# frozen_string_literal: true module Facter module Utils # Sort nested hash. def self.sort_hash_by_key(hash, recursive = true, &block) hash.keys.sort(&block).each_with_object({}) do |key, seed| seed[key] = hash[key] seed[key] = sort_hash_by_key(seed[key], true, &block) if recursive && seed[key].is_a?(Hash) seed end end def self.deep_copy(obj) Marshal.load(Marshal.dump(obj)) end def self.split_user_query(user_query) queries = user_query.split('.') queries.map! { |query| query =~ /^[0-9]+$/ ? query.to_i : query } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facter-4.0.8.pre | lib/framework/utils/utils.rb |
facter-4.0.7.pre | lib/framework/utils/utils.rb |