Class: Argo::PropertyFactory
- Inherits:
-
Object
- Object
- Argo::PropertyFactory
- Extended by:
- Forwardable
- Defined in:
- lib/argo/property_factory.rb
Constant Summary collapse
- TYPE_MAP =
{ 'array' => ArrayProperty, 'boolean' => BooleanProperty, 'integer' => IntegerProperty, 'number' => NumberProperty, 'object' => ObjectProperty, 'string' => StringProperty }
Instance Method Summary collapse
- #build(body, name: nil) ⇒ Object
-
#initialize(dereferencer, required_fields = []) ⇒ PropertyFactory
constructor
A new instance of PropertyFactory.
Constructor Details
#initialize(dereferencer, required_fields = []) ⇒ PropertyFactory
Returns a new instance of PropertyFactory.
25 26 27 28 |
# File 'lib/argo/property_factory.rb', line 25 def initialize(dereferencer, required_fields = []) @dereferencer = dereferencer @required_fields = required_fields end |
Instance Method Details
#build(body, name: nil) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/argo/property_factory.rb', line 32 def build(body, name: nil) class_for_type(body).new( constraints: constraints(body), description: body['description'], required: required?(name), **additional_properties(body) ) end |