Sha256: d488e9a63a216fb998e436e134ca366ccd02da7d1c8c7350a2562ecf1d558734
Contents?: true
Size: 509 Bytes
Versions: 1
Compression:
Stored size: 509 Bytes
Contents
# frozen_string_literal: true module Speculation # @private module Conj refine Array do def conj(x) self + [x] end end refine Set do def conj(x) self + Set[x] end end refine Hash do def conj(x) if Utils.array?(x) unless x.count == 2 raise ArgumentError, "Array arg to conj must be a pair" end merge(x[0] => x[1]) else merge(x) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
speculation-0.1.0 | lib/speculation/conj.rb |