Sha256: 96630d11fad066b74a0021d8f574c9f1fef70452b557294da4d28e57cff5dda9

Contents?: true

Size: 706 Bytes

Versions: 13

Compression:

Stored size: 706 Bytes

Contents

module Eco
  module API
    class UseCases
      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, :export]

        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

13 entries across 13 versions & 1 rubygems

Version Path
eco-helpers-1.0.11 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.10 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.9 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.8 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.7 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.6 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.5 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.4 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.3 lib/eco/api/usecases/base_case.rb
eco-helpers-0.9.5 lib/eco/api/usecases/base_case.rb
eco-helpers-1.0.2 lib/eco/api/usecases/base_case.rb
eco-helpers-0.9.4 lib/eco/api/usecases/base_case.rb
eco-helpers-0.9.3 lib/eco/api/usecases/base_case.rb