Sha256: 2e219e518dc8fab0cb71e9e4e437a13206fb784b9291d1201187943219380741

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

module GrpcMock
  module Response
    class ExceptionValue
      def initialize(exception)
        @exception = case exception
                     when String
                       StandardError.new(exception)
                     when Class
                       exception.new('Exception from GrpcMock')
                     when Exception
                       exception
                     else
                       raise ArgumentError.new(message: "Invalid exception class: #{exception.class}")
                     end
      end

      def evaluate
        raise @exception.dup
      end
    end

    class Value
      def initialize(value)
        @value = value
      end

      def evaluate
        @value.dup
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
gruffish-0.5.0.pre1 lib/grpc_mock/response.rb
grpc_mock-0.4.0 lib/grpc_mock/response.rb
grpc_mock-0.3.1 lib/grpc_mock/response.rb