Module: Avro::Builder

Defined in:
lib/avro/builder.rb,
lib/avro/builder/dsl.rb,
lib/avro/builder/enum.rb,
lib/avro/builder/field.rb,
lib/avro/builder/fixed.rb,
lib/avro/builder/errors.rb,
lib/avro/builder/record.rb,
lib/avro/builder/railtie.rb,
lib/avro/builder/version.rb,
lib/avro/builder/aliasable.rb,
lib/avro/builder/types/type.rb,
lib/avro/builder/dsl_options.rb,
lib/avro/builder/file_handler.rb,
lib/avro/builder/schema_store.rb,
lib/avro/builder/type_factory.rb,
lib/avro/builder/namespaceable.rb,
lib/avro/builder/dsl_attributes.rb,
lib/avro/builder/types/map_type.rb,
lib/avro/builder/anonymous_types.rb,
lib/avro/builder/types/enum_type.rb,
lib/avro/builder/types/top_level.rb,
lib/avro/builder/definition_cache.rb,
lib/avro/builder/types/array_type.rb,
lib/avro/builder/types/fixed_type.rb,
lib/avro/builder/types/named_type.rb,
lib/avro/builder/types/union_type.rb,
lib/avro/builder/types/record_type.rb,
lib/avro/builder/types/complex_type.rb,
lib/avro/builder/types/type_referencer.rb,
lib/avro/builder/rake/avro_generate_task.rb,
lib/avro/builder/types/named_error_handling.rb,
lib/avro/builder/schema_serializer_reference_state.rb

Defined Under Namespace

Modules: Aliasable, AnonymousTypes, DslAttributes, DslOptions, FileHandler, Namespaceable, Rake, TypeFactory, Types Classes: DSL, DefinitionCache, DefinitionNotFoundError, DuplicateDefinitionError, Enum, Field, Fixed, Railtie, Record, RequiredAttributeError, SchemaError, SchemaSerializerReferenceState, SchemaStore

Constant Summary collapse

AttributeError =
Class.new(StandardError)
VERSION =
'0.16.1'.freeze

Class Method Summary collapse

Class Method Details

.add_load_path(*paths) ⇒ Object

Add paths that will be searched for definitions


24
25
26
# File 'lib/avro/builder.rb', line 24

def self.add_load_path(*paths)
  Avro::Builder::DSL.load_paths.merge(paths)
end

.build(str = nil, filename: nil, &block) ⇒ Object

Accepts a string or block to eval to define a JSON schema


14
15
16
# File 'lib/avro/builder.rb', line 14

def self.build(str = nil, filename: nil, &block)
  Avro::Builder::DSL.new(str, filename: filename, &block).to_json
end

.build_dsl(str = nil, filename: nil, &block) ⇒ Object

Accepts a string or block to eval and returns the Avro::Builder::DSL object


9
10
11
# File 'lib/avro/builder.rb', line 9

def self.build_dsl(str = nil, filename: nil, &block)
  Avro::Builder::DSL.new(str, filename: filename, &block)
end

.build_schema(str = nil, filename: nil, &block) ⇒ Object

Accepts a string or block to eval and returns an Avro::Schema object


19
20
21
# File 'lib/avro/builder.rb', line 19

def self.build_schema(str = nil, filename: nil, &block)
  Avro::Builder::DSL.new(str, filename: filename, &block).as_schema
end