Class: RSchema::GenericSetSchema

Inherits:
Struct
  • Object
show all
Defined in:
lib/rschema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#subschemaObject

Returns the value of attribute subschema

Returns:

  • (Object)

    the current value of subschema



177
178
179
# File 'lib/rschema.rb', line 177

def subschema
  @subschema
end

Instance Method Details

#schema_walk(value, mapper) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
# File 'lib/rschema.rb', line 178

def schema_walk(value, mapper)
  return RSchema::ErrorDetails.new(value, 'is not a Set') if not value.is_a?(Set)

  value.reduce(Set.new) do |accum, subvalue|
    subvalue_walked, error = RSchema.walk(subschema, subvalue, mapper)
    break error.extend_key_path('.values') if error

    accum << subvalue_walked
    accum
  end
end