Sha256: 1d22c45cd4129f20eb3d70d673b50c00c54e59a06d15e062c1f4349864255bc0

Contents?: true

Size: 554 Bytes

Versions: 4

Compression:

Stored size: 554 Bytes

Contents

# frozen_string_literal: true
require 'request_handler/error'
module RequestHandler
  class OptionParser
    def initialize(params:, allowed_options_type:)
      @params = params
      @allowed_options_type = allowed_options_type
      raise InternalArgumentError, allowed_options_type: 'must be a Enum' unless enum?
    end

    private

    def enum?
      @allowed_options_type.class.equal?(Dry::Types::Enum)
    end

    def empty_param?(param)
      params.fetch(param) { nil } == ''
    end
    attr_reader :params, :allowed_options_type
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
request_handler-0.11.0 lib/request_handler/option_parser.rb
request_handler-0.10.0 lib/request_handler/option_parser.rb
request_handler-0.9.1 lib/request_handler/option_parser.rb
request_handler-0.9.0 lib/request_handler/option_parser.rb