Class: Contracts::Constraints::Predicate
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
-
#initialize(description, &block) ⇒ Predicate
constructor
A new instance of Predicate.
- #matches?(value) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(description, &block) ⇒ Predicate
Returns a new instance of Predicate.
224 225 226 227 |
# File 'lib/contracts.rb', line 224 def initialize(description, &block) (@description = description @block = block) end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
230 231 232 |
# File 'lib/contracts.rb', line 230 def description @description end |
Instance Method Details
#matches?(value) ⇒ Boolean
229 |
# File 'lib/contracts.rb', line 229 def matches?(value) = @block.call(value) |