Class: RSchema::EnumSchema
- Inherits:
-
Struct
- Object
- Struct
- RSchema::EnumSchema
- Defined in:
- lib/rschema.rb
Instance Attribute Summary collapse
-
#subschema ⇒ Object
Returns the value of attribute subschema.
-
#value_set ⇒ Object
Returns the value of attribute value_set.
Instance Method Summary collapse
Instance Attribute Details
#subschema ⇒ Object
Returns the value of attribute subschema
193 194 195 |
# File 'lib/rschema.rb', line 193 def subschema @subschema end |
#value_set ⇒ Object
Returns the value of attribute value_set
193 194 195 |
# File 'lib/rschema.rb', line 193 def value_set @value_set end |
Instance Method Details
#schema_walk(value, mapper) ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/rschema.rb', line 194 def schema_walk(value, mapper) value_walked = if subschema v, error = RSchema.walk(subschema, value, mapper) return error if error v else value end if value_set.include?(value_walked) value_walked else RSchema::ErrorDetails.new("#{value_walked} is not a valid enum member") end end |