Module: Avro::Builder

Defined in:
lib/avro/builder.rb,
lib/avro/builder/dsl.rb,
lib/avro/builder/field.rb,
lib/avro/builder/errors.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/type_factory.rb,
lib/avro/builder/namespaceable.rb,
lib/avro/builder/dsl_attributes.rb,
lib/avro/builder/types/map_type.rb,
lib/avro/builder/types/enum_type.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/types/configurable_type.rb,
lib/avro/builder/schema_serializer_reference_state.rb

Defined Under Namespace

Modules: Aliasable, DslAttributes, DslOptions, FileHandler, Namespaceable, TypeFactory, Types Classes: DSL, DefinitionCache, DefinitionNotFoundError, DuplicateDefinitionError, Field, RequiredAttributeError, SchemaSerializerReferenceState, UnsupportedBlockAttributeError

Constant Summary collapse

VERSION =
'0.6.0'.freeze

Class Method Summary collapse

Class Method Details

.add_load_path(*paths) ⇒ Object

Add paths that will be searched for definitions



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

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

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

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



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

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

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

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



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

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