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

Instance Method Summary collapse

Instance Method Details

#pub_name(**kwargs) ⇒ Object

block name in commands and documents



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

def pub_name(**kwargs)
  full = fetch(:nickname, nil) || fetch(:oname, nil)
  full&.to_s&.pub_name(**kwargs)
end

#sort_by_keyObject



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

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

#sym_keysObject



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

def sym_keys
  transform_keys(&:to_sym)
end