Sha256: 4b47bb0ded4fa6cb0a38176d6502e589664005bec3f77297d52e3b0fcfcd80d9
Contents?: true
Size: 869 Bytes
Versions: 33
Compression:
Stored size: 869 Bytes
Contents
module Eco module API class UseCases # Core class of UseCases. It basically defines and manages allowed `types` class BaseCase class InvalidType < Exception def initialize(msg = nil, type:, types:) msg ||= "Invalid type." msg = "Given type '#{type}'. Valid types: #{types}" super(msg) end end extend Eco::API::Common::ClassHelpers @types = [:import, :filter, :transform, :sync, :error_handler, :export, :other] class << self attr_reader :types def valid_type?(type) types.include?(type) end def validate_type(type) raise InvalidType.new(type: type, types: types) unless valid_type?(type) end end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems