Sha256: dc1741533444b2a7bb0bf5c05a186e696b27478d04116c8affde1059fbb5b52b

Contents?: true

Size: 982 Bytes

Versions: 6

Compression:

Stored size: 982 Bytes

Contents

# encoding: utf-8

module NameMagic::HashMethods
  # Maps the hash into one whose keys have been replaced with full
  # names of the keys (using #full_name method).
  # 
  def keys_to_names # FIXME: Change to #keys_to_full_names
    with_keys do |key| key.name || key end
    # FIXME: Change #name to #full_name
  end

  # Modifies a hash in place so that the keys are replaced with key
  # names (key objects are assumed to respond to +#name+ method).
  # 
  def keys_to_names! # FIXME: Change to #keys_to_full_names!
    with_keys! do |key| key.name || key end
    # FIXME: Change #name to #full_name
  end

  # Maps the hash into one whose keys have been replaced with
  # names of the key objects (using #_name_ method).
  # 
  def keys_to_ɴ
    with_keys do |key| key._name_ || key end
  end

  # Modifies a hash in place so that the keys are replaced with key
  # names (using +#_name_+ method).
  # 
  def keys_to_ɴ!
    with_keys! do |key| key._name_ || key end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
y_support-2.5.3 lib/y_support/name_magic/hash_methods.rb
y_support-2.5.2 lib/y_support/name_magic/hash_methods.rb
y_support-2.5.1 lib/y_support/name_magic/hash_methods.rb
y_support-2.4.6 lib/y_support/name_magic/hash_methods.rb
y_support-2.4.5 lib/y_support/name_magic/hash_methods.rb
y_support-2.4.4 lib/y_support/name_magic/hash_methods.rb