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
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 |
#get ⇒ Object
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) |
#represent ⇒ String
38 |
# File 'lib/dry/effects/providers/cmp.rb', line 38 def represent = "cmp[#{id}=#{@value}]" |