Sha256: df808159558346a31b2f963f22e1644a55fda136b528d19767892fa8959c5ab4
Contents?: true
Size: 997 Bytes
Versions: 2
Compression:
Stored size: 997 Bytes
Contents
# frozen_string_literal: true require "dry/effects/provider" module Dry module Effects module Providers class Cmp < Provider[:cmp] include ::Dry::Equalizer(:id, :value, inspect: false) attr_reader :value param :id def get value end # Yield the block with the handler installed # # @return [Array(Any, Any)] # @api private def call(value = Undefined) if Undefined.equal?(value) @value = false first = yield @value = true [first, yield] else @value = value yield end end # @param [Effect] effect # @return [Boolean] # @api public def provide?(effect) super && id.equal?(effect.id) end # @return [String] # @api public def represent "cmp[#{id}=#{@value}]" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-effects-0.3.0 | lib/dry/effects/providers/cmp.rb |
dry-effects-0.2.0 | lib/dry/effects/providers/cmp.rb |