Class: Hash

Inherits:
Object show all
Defined in:
lib/hash.rb,
lib/namer.rb

Overview

hash with keys sorted by name add Hash.sym_keys

Direct Known Subclasses

DOH

Instance Method Summary collapse

Instance Method Details

#pub_name(**kwargs) ⇒ Object

block name in commands and documents



11
12
13
14
15
16
# File 'lib/namer.rb', line 11

def pub_name(**kwargs)
  full = fetch(:nickname, nil) || fetch(:oname, nil)
  full&.to_s&.pub_name(**kwargs).tap { |ret|
    pp [__LINE__, 'Hash.pub_name() ->', ret] if $pd
  }
end

#sort_by_keyObject



11
12
13
# File 'lib/hash.rb', line 11

def sort_by_key
  keys.sort.to_h { |key| [key, self[key]] }
end

#sym_keysObject



17
18
19
# File 'lib/hash.rb', line 17

def sym_keys
  transform_keys(&:to_sym)
end