Module: Pcrd::Options

Defined in:
lib/pcrd/options.rb

Overview

Normalizes the options hash once at the boundary so commands can use symbol keys consistently, instead of guarding every read with ‘options || options`. Accepts Thor’s string-keyed options, a plain symbol hash, or nil.

Class Method Summary collapse

Class Method Details

.normalize(opts) ⇒ Object



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

def normalize(opts)
  (opts || {}).to_h.transform_keys(&:to_sym)
end