Class: Datacaster::ContextNode
- Inherits:
-
Base
- Object
- Base
- Datacaster::ContextNode
show all
- Defined in:
- lib/datacaster/context_node.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
Returns a new instance of ContextNode.
3
4
5
|
# File 'lib/datacaster/context_node.rb', line 3
def initialize(base)
@base = base
end
|
Instance Method Details
#cast(object, runtime:) ⇒ Object
7
8
9
10
11
|
# File 'lib/datacaster/context_node.rb', line 7
def cast(object, runtime:)
@runtime = create_runtime(runtime)
result = @base.with_runtime(@runtime).call(object)
transform_result(result)
end
|
#inspect ⇒ Object
21
22
23
|
# File 'lib/datacaster/context_node.rb', line 21
def inspect
"#<#{self.class.name} base: #{@base.inspect}>"
end
|
#to_json_schema ⇒ Object
13
14
15
|
# File 'lib/datacaster/context_node.rb', line 13
def to_json_schema
@base.to_json_schema
end
|
#to_json_schema_attributes ⇒ Object
17
18
19
|
# File 'lib/datacaster/context_node.rb', line 17
def to_json_schema_attributes
@base.to_json_schema_attributes
end
|