Class: Hash
Overview
hash with keys sorted by name add Hash.sym_keys
Direct Known Subclasses
Instance Method Summary collapse
-
#pub_name(**kwargs) ⇒ Object
block name in commands and documents.
- #sort_by_key ⇒ Object
- #sym_keys ⇒ Object
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_key ⇒ Object
11 12 13 |
# File 'lib/hash.rb', line 11 def sort_by_key keys.sort.to_h { |key| [key, self[key]] } end |
#sym_keys ⇒ Object
17 18 19 |
# File 'lib/hash.rb', line 17 def sym_keys transform_keys(&:to_sym) end |