Sha256: 4b5626e517bc7ecd6fca5872fccd2547698d7d8af7d12dc7bdd7e9736a8aeb35

Contents?: true

Size: 338 Bytes

Versions: 1

Compression:

Stored size: 338 Bytes

Contents

module Haskell
  module AssertRtnType
    extend Base

    def self.execute(meth, rtn, klass)
      if wrong_type?(rtn, klass)
        raise TypeError, "Expected #{meth} to return #{klass} but got #{rtn.inspect} instead"
      end
    end

    def self.wrong_type?(obj, klass)
      !(obj.is_a?(klass) || klass == Any)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
haskell-0.0.3 lib/haskell/assert_rtn_type.rb