Sha256: db6954231a6fbb563cc9ed49282ced45a40fc9e7125e4ea1c869fd52cda4b27a

Contents?: true

Size: 662 Bytes

Versions: 4

Compression:

Stored size: 662 Bytes

Contents

module Liberic
  module Helpers
    module Invocation
      class Error < StandardError
      end

      extend self

      def raise_on_error(value)
        return value if value == SDK::Fehlercodes::ERIC_OK
        raise Error.new(SDK::Fehlercodes::CODES[value])
      end

      def with_result_buffer(raise_on_error = true, &block)
        handle = SDK::API.rueckgabepuffer_erzeugen
        if raise_on_error
          raise_on_error(yield(handle))
        else
          yield(handle)
        end
        result = Liberic::SDK::API.rueckgabepuffer_inhalt(handle)
        SDK::API.rueckgabepuffer_freigeben(handle)
        result
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
liberic-1.3.1 lib/liberic/helpers/invocation.rb
liberic-1.3.0 lib/liberic/helpers/invocation.rb
liberic-1.2.0 lib/liberic/helpers/invocation.rb
liberic-1.1.0 lib/liberic/helpers/invocation.rb