Sha256: a0b8cdc0ef210df0f3a617ed2c7d7c5a3b4a861a3e5a8d509042112163570b45

Contents?: true

Size: 284 Bytes

Versions: 3

Compression:

Stored size: 284 Bytes

Contents

module KF5
  module Helper
    def self.indifferent_access(hash, key)
      hash[key.to_s] || hash[key.to_sym]
    end

    def self.copy_if_exist(from_hash, to_hash, key)
      value = indifferent_access(from_hash, key)
      to_hash[key] = value unless value.nil?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kf5-0.4.0 lib/kf5/helper.rb
kf5-0.3.3 lib/kf5/helper.rb
kf5-0.3.2 lib/kf5/helper.rb