Sha256: 1dc1f517e482bf23e53c26569eaaafc61c77feb186244aa168b627ccef54c176

Contents?: true

Size: 985 Bytes

Versions: 7

Compression:

Stored size: 985 Bytes

Contents

# frozen_string_literal: true

require 'avro/builder/version'
require 'avro/builder/dsl'
require 'avro/builder/schema_store'

module Avro
  module Builder

    # Accepts a string or block to eval and returns the Avro::Builder::DSL object
    def self.build_dsl(str = nil, filename: nil, &block)
      Avro::Builder::DSL.new(str, filename: filename, &block)
    end

    # Accepts a string or block to eval to define a JSON schema
    def self.build(str = nil, filename: nil, &block)
      Avro::Builder::DSL.new(str, filename: filename, &block).to_json
    end

    # Accepts a string or block to eval and returns an Avro::Schema object
    def self.build_schema(str = nil, filename: nil, &block)
      Avro::Builder::DSL.new(str, filename: filename, &block).as_schema
    end

    # Add paths that will be searched for definitions
    def self.add_load_path(*paths)
      Avro::Builder::DSL.load_paths.merge(paths)
    end
  end
end

require 'avro/builder/railtie' if defined?(Rails)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
avro-builder-2.1.0 lib/avro/builder.rb
avro-builder-2.0.0 lib/avro/builder.rb
avro-builder-1.1.0 lib/avro/builder.rb
avro-builder-1.0.1 lib/avro/builder.rb
avro-builder-1.0.0 lib/avro/builder.rb
avro-builder-0.17.0 lib/avro/builder.rb
avro-builder-0.16.2 lib/avro/builder.rb