Module: ElasticGraph::SchemaDefinition::Mixins::SupportsDefaultValue
- Included in:
- SchemaElements::Argument
- Defined in:
- elasticgraph-schema_definition/lib/elastic_graph/schema_definition/mixins/supports_default_value.rb
Overview
A mixin designed to be included in a schema element class that supports default values.
Designed to be prepended
so that it can hook into initialize
.
Instance Method Summary collapse
-
#default(default_value) ⇒ void
Used to specify the default value for this field or argument.
-
#default_value_sdl ⇒ String
Generates SDL for the default value.
Instance Method Details
#default(default_value) ⇒ void
This method returns an undefined value.
Used to specify the default value for this field or argument.
27 28 29 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/mixins/supports_default_value.rb', line 27 def default(default_value) @default_value = default_value end |
#default_value_sdl ⇒ String
Generates SDL for the default value. Suitable for inclusion in the schema elememnts #to_sdl
.
34 35 36 37 |
# File 'elasticgraph-schema_definition/lib/elastic_graph/schema_definition/mixins/supports_default_value.rb', line 34 def default_value_sdl return nil if @default_value == NO_DEFAULT_PROVIDED " = #{Support::GraphQLFormatter.serialize(@default_value)}" end |