Sha256: f95198cc8c90e4a2ba7b1d2dd7b118c883ff0374d2439595d7ae659edfc2e753

Contents?: true

Size: 812 Bytes

Versions: 24

Compression:

Stored size: 812 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

        @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

24 entries across 24 versions & 1 rubygems

Version Path
eco-helpers-1.5.1 lib/eco/api/usecases/base_case.rb
eco-helpers-1.5.0 lib/eco/api/usecases/base_case.rb
eco-helpers-1.4.2 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.19 lib/eco/api/usecases/base_case.rb
eco-helpers-1.4.1 lib/eco/api/usecases/base_case.rb
eco-helpers-1.4.0 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.18 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.17 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.16 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.15 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.14 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.13 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.12 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.11 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.10 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.9 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.8 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.7 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.6 lib/eco/api/usecases/base_case.rb
eco-helpers-1.3.5 lib/eco/api/usecases/base_case.rb