Class: Dry::Effects::Providers::Cmp

Inherits:
Object
  • Object
show all
Defined in:
lib/dry/effects/providers/cmp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9
10
11
# File 'lib/dry/effects/providers/cmp.rb', line 9

def value
  @value
end

Instance Method Details

#call(value = Undefined) ⇒ Array(Any, Any)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yield the block with the handler installed



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dry/effects/providers/cmp.rb', line 19

def call(value = Undefined)
  if Undefined.equal?(value)
    @value = false
    first = yield
    @value = true
    [first, yield]
  else
    @value = value
    yield
  end
end

#getObject



13
# File 'lib/dry/effects/providers/cmp.rb', line 13

def get = value

#provide?(effect) ⇒ Boolean



34
# File 'lib/dry/effects/providers/cmp.rb', line 34

def provide?(effect) = super && id.equal?(effect.id)

#representString



38
# File 'lib/dry/effects/providers/cmp.rb', line 38

def represent = "cmp[#{id}=#{@value}]"