Sha256: d3ffacb23d50dda7e51ea199e25184e60d61df70156fb06eee80aead9f0554f3
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
# frozen_string_literal: true module Speculation # @private module UtilsSpecs using Speculation::NamespacedSymbols.refine(self) S = Speculation U = Speculation::Utils S.fdef(U.method(:hash?), :args => S.tuple(:any.ns(S)), :ret => :boolean.ns(S)) S.fdef(U.method(:array?), :args => S.tuple(:any.ns(S)), :ret => :boolean.ns(S)) S.fdef(U.method(:collection?), :args => S.tuple(:any.ns(S)), :ret => :boolean.ns(S)) S.fdef(U.method(:identity), :args => S.cat(:x => :any.ns(S)), :ret => :any.ns(S), :fn => ->(x) { x[:args][:x].equal?(x[:ret]) }) S.fdef(U.method(:complement), :args => :empty.ns(S), :block => S.fspec(:args => S.zero_or_more(:any.ns(S)), :ret => :any.ns(S)), :ret => S.fspec(:args => S.zero_or_more(:any.ns(S)), :ret => :boolean.ns(S))) S.fdef(U.method(:constantly), :args => S.cat(:x => :any.ns(S)), :ret => Proc, :fn => ->(x) { x[:args][:x].equal?(x[:ret].call) }) S.fdef(U.method(:distinct?), :args => S.cat(:coll => Enumerable), :ret => :boolean.ns(S)) S.fdef(U.method(:ident?), :args => S.cat(:x => :any.ns(S)), :ret => :boolean.ns(S)) S.fdef(U.method(:method?), :args => S.cat(:x => :any.ns(S)), :ret => :boolean.ns(S)) S.fdef(U.method(:empty), :args => S.cat(:coll => Enumerable), :ret => S.and(Enumerable, ->(coll) { coll.empty? }), :fn => ->(x) { x[:args][:coll].class == x[:ret].class }) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
speculation-0.1.0 | lib/speculation/utils_specs.rb |