Class: Kube::Station::SchemaFields
- Inherits:
-
Object
- Object
- Kube::Station::SchemaFields
- Defined in:
- app/models/kube/station/schema_fields.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(schema, data) ⇒ SchemaFields
constructor
A new instance of SchemaFields.
Constructor Details
#initialize(schema, data) ⇒ SchemaFields
Returns a new instance of SchemaFields.
10 11 12 13 |
# File 'app/models/kube/station/schema_fields.rb', line 10 def initialize(schema, data) @schema = schema @data = data || {} end |
Class Method Details
.call(schema, data) ⇒ Object
6 7 8 |
# File 'app/models/kube/station/schema_fields.rb', line 6 def self.call(schema, data) new(schema, data).call end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/models/kube/station/schema_fields.rb', line 15 def call properties = @schema.value["properties"] || {} required = @schema.value["required"] || [] properties.map do |name, prop| build_field(name, prop, value_for(@data, name), "resource[#{name}]", required.include?(name)) end end |