Sha256: dc75912424b8122c4b2222e96305125b15222c445dffa48ab7808e56ac555086
Contents?: true
Size: 577 Bytes
Versions: 5
Compression:
Stored size: 577 Bytes
Contents
module Monolens module Object class Rename include Lens signature(Type::Object, Type::Object, { defn: [Type::Map.of(Type::Name, Type::Name), false], }) def call(arg, world = {}) is_hash!(arg, world) dup = arg.dup option(:defn, {}).each_pair do |oldname, newname| actual_name, value = fetch_on(oldname, arg) newname = actual_name.is_a?(Symbol) ? newname.to_sym : newname.to_s dup.delete(actual_name) dup[newname] = value end dup end end end end
Version data entries
5 entries across 5 versions & 1 rubygems