Class: Datacaster::JsonSchemaAttributes
- Inherits:
-
Base
- Object
- Base
- Datacaster::JsonSchemaAttributes
show all
- Defined in:
- lib/datacaster/json_schema_attributes.rb
Instance Method Summary
collapse
Methods included from Mixin
#&, #*, #call, #call_with_runtime, #cast_errors, #i18n_key, #i18n_map_keys, #i18n_scope, #i18n_vars, #json_schema, #json_schema_attributes, #then, #with_context, #with_object_context, #with_runtime, #|
Constructor Details
#initialize(base, schema_attributes = {}, &block) ⇒ JsonSchemaAttributes
Returns a new instance of JsonSchemaAttributes.
3
4
5
6
7
|
# File 'lib/datacaster/json_schema_attributes.rb', line 3
def initialize(base, schema_attributes = {}, &block)
@base = base
@schema_attributes = schema_attributes
@block = block
end
|
Instance Method Details
#cast(object, runtime:) ⇒ Object
9
10
11
|
# File 'lib/datacaster/json_schema_attributes.rb', line 9
def cast(object, runtime:)
@base.cast(object, runtime: runtime)
end
|
#inspect ⇒ Object
24
25
26
|
# File 'lib/datacaster/json_schema_attributes.rb', line 24
def inspect
"#<#{self.class.name} base: #{@base.inspect}>"
end
|
#to_json_schema ⇒ Object
20
21
22
|
# File 'lib/datacaster/json_schema_attributes.rb', line 20
def to_json_schema
@base.to_json_schema
end
|
#to_json_schema_attributes ⇒ Object
13
14
15
16
17
18
|
# File 'lib/datacaster/json_schema_attributes.rb', line 13
def to_json_schema_attributes
result = @base.to_json_schema_attributes
result = result.merge(@schema_attributes)
result = @block.(result) if @block
result
end
|