Module: ElasticGraph::ProtoIngestion::SchemaDefinition::FactoryExtension

Defined in:
elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb

Overview

Extension module applied to Factory to add proto support.

Instance Method Summary collapse

Instance Method Details

#new_enum_type(name) {|ElasticGraph::SchemaDefinition::SchemaElements::EnumType| ... } ⇒ ElasticGraph::SchemaDefinition::SchemaElements::EnumType

Creates a new enum type with proto extensions.



26
27
28
29
30
31
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 26

def new_enum_type(name)
  super(name) do |type|
    extended_type = type.extend(SchemaElements::EnumTypeExtension) # : ::ElasticGraph::SchemaDefinition::SchemaElements::EnumType & SchemaElements::EnumTypeExtension
    yield extended_type if block_given?
  end
end

#new_enum_value(name, original_name) {|ElasticGraph::SchemaDefinition::SchemaElements::EnumValue| ... } ⇒ ElasticGraph::SchemaDefinition::SchemaElements::EnumValue

Creates a new enum value with proto extensions.

Parameters:

  • name (String)

    enum value name

  • original_name (String)

    enum value name before overrides

Yields:

Returns:



39
40
41
42
43
44
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 39

def new_enum_value(name, original_name)
  super(name, original_name) do |value|
    extended_value = value.extend(SchemaElements::EnumValueExtension) # : ::ElasticGraph::SchemaDefinition::SchemaElements::EnumValue & SchemaElements::EnumValueExtension
    yield extended_value if block_given?
  end
end

#new_interface_type(name) {|ElasticGraph::SchemaDefinition::SchemaElements::InterfaceType| ... } ⇒ ElasticGraph::SchemaDefinition::SchemaElements::InterfaceType

Creates a new interface type with proto extensions.



51
52
53
54
55
56
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 51

def new_interface_type(name)
  super(name) do |type|
    extended_type = type.extend(SchemaElements::ObjectInterfaceAndUnionExtension) # : ::ElasticGraph::SchemaDefinition::SchemaElements::InterfaceType & SchemaElements::ObjectInterfaceAndUnionExtension
    yield extended_type if block_given?
  end
end

#new_object_type(name) {|ElasticGraph::SchemaDefinition::SchemaElements::ObjectType| ... } ⇒ ElasticGraph::SchemaDefinition::SchemaElements::ObjectType

Creates a new object type with proto extensions.



63
64
65
66
67
68
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 63

def new_object_type(name)
  super(name) do |type|
    extended_type = type.extend(SchemaElements::ObjectInterfaceAndUnionExtension) # : ::ElasticGraph::SchemaDefinition::SchemaElements::ObjectType & SchemaElements::ObjectInterfaceAndUnionExtension
    yield extended_type if block_given?
  end
end

#new_resultsElasticGraph::SchemaDefinition::Results

Creates a new results object and extends it with proto generation APIs.



99
100
101
102
103
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 99

def new_results
  super.tap do |results|
    results.extend ResultsExtension
  end
end

#new_scalar_type(name) {|ElasticGraph::SchemaDefinition::SchemaElements::ScalarType| ... } ⇒ ElasticGraph::SchemaDefinition::SchemaElements::ScalarType

Creates a new scalar type with proto extensions.



75
76
77
78
79
80
81
82
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 75

def new_scalar_type(name)
  super(name) do |type|
    extended_type = type.extend(SchemaElements::ScalarTypeExtension) # : ::ElasticGraph::SchemaDefinition::SchemaElements::ScalarType & SchemaElements::ScalarTypeExtension
    extended_type.initialize_proto_extension do
      yield extended_type if block_given?
    end
  end
end

#new_schema_artifact_managerElasticGraph::SchemaDefinition::SchemaArtifactManager

Creates a new schema artifact manager and extends it with proto artifact support.

Returns:

  • (ElasticGraph::SchemaDefinition::SchemaArtifactManager)


108
109
110
111
112
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 108

def new_schema_artifact_manager(...)
  super.tap do |manager|
    manager.extend SchemaArtifactManagerExtension
  end
end

#new_union_type(name) {|ElasticGraph::SchemaDefinition::SchemaElements::UnionType| ... } ⇒ ElasticGraph::SchemaDefinition::SchemaElements::UnionType

Creates a new union type with proto extensions.



89
90
91
92
93
94
# File 'elasticgraph-proto_ingestion/lib/elastic_graph/proto_ingestion/schema_definition/factory_extension.rb', line 89

def new_union_type(name)
  super(name) do |type|
    extended_type = type.extend(SchemaElements::ObjectInterfaceAndUnionExtension) # : ::ElasticGraph::SchemaDefinition::SchemaElements::UnionType & SchemaElements::ObjectInterfaceAndUnionExtension
    yield extended_type if block_given?
  end
end