Class: Dry::Effects::Providers::Cmp
- Inherits:
-
Object
- Object
- Dry::Effects::Providers::Cmp
- Defined in:
- lib/dry/effects/providers/cmp.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#call(value = Undefined) ⇒ Array(Any, Any)
private
Yield the block with the handler installed.
- #get ⇒ Object
- #provide?(effect) ⇒ Boolean
- #represent ⇒ String
Instance Attribute Details
#value ⇒ Object (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
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dry/effects/providers/cmp.rb', line 21 def call(value = Undefined) if Undefined.equal?(value) @value = false first = yield @value = true [first, yield] else @value = value yield end end |
#get ⇒ Object
13 14 15 |
# File 'lib/dry/effects/providers/cmp.rb', line 13 def get value end |
#provide?(effect) ⇒ Boolean
36 37 38 |
# File 'lib/dry/effects/providers/cmp.rb', line 36 def provide?(effect) super && id.equal?(effect.id) end |
#represent ⇒ String
42 43 44 |
# File 'lib/dry/effects/providers/cmp.rb', line 42 def represent "cmp[#{id}=#{@value}]" end |