Class: RSchema::PredicateSchema
- Inherits:
-
Struct
- Object
- Struct
- RSchema::PredicateSchema
- Defined in:
- lib/rschema.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block
218 219 220 |
# File 'lib/rschema.rb', line 218 def block @block end |
#name ⇒ Object
Returns the value of attribute name
218 219 220 |
# File 'lib/rschema.rb', line 218 def name @name end |
Instance Method Details
#inspect ⇒ Object
227 228 229 |
# File 'lib/rschema.rb', line 227 def inspect 'predicate' + (name ? "(#{name.inspect})" : '') end |
#schema_walk(value, mapper) ⇒ Object
219 220 221 222 223 224 225 |
# File 'lib/rschema.rb', line 219 def schema_walk(value, mapper) if block.call(value) value else RSchema::ErrorDetails.new(value, 'fails predicate' + (name ? ": #{name}" : '')) end end |