Class: CryptReboot::Cli::Params::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/crypt_reboot/cli/params/parser.rb

Overview

Parse given ARGV and return params hash or raise exception with error summary

Constant Summary collapse

ParseError =
Class.new StandardError

Instance Method Summary collapse

Instance Method Details

#call(raw_params) ⇒ Object

Raises:



10
11
12
13
14
15
# File 'lib/crypt_reboot/cli/params/parser.rb', line 10

def call(raw_params)
  params = definition.parse(raw_params).params
  raise ParseError, params.errors.summary unless params.valid?

  flattener.call params.to_h
end