Class: AvroGen::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/avro_gen/configuration.rb

Overview

Configuration for schema class generation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



32
33
34
# File 'lib/avro_gen/configuration.rb', line 32

def initialize
  reset!
end

Instance Attribute Details

#generated_class_pathString

Local path for schema classes to be generated in.

Returns:

  • (String)


12
13
14
# File 'lib/avro_gen/configuration.rb', line 12

def generated_class_path
  @generated_class_path
end

#nest_child_schemasBoolean

Set to false to generate child schemas as their own files.

Returns:

  • (Boolean)


16
17
18
# File 'lib/avro_gen/configuration.rb', line 16

def nest_child_schemas
  @nest_child_schemas
end

#root_moduleString

The top-level module that generated classes are nested under.

Returns:

  • (String)


30
31
32
# File 'lib/avro_gen/configuration.rb', line 30

def root_module
  @root_module
end

#schema_namespace_mapHash

Use this option to reduce nesting when using use_full_namespace. For example: { 'com.mycompany.suborg' => 'SchemaClasses' } would replace a prefix matching the given key with the module name SchemaClasses.

Returns:

  • (Hash)


26
27
28
# File 'lib/avro_gen/configuration.rb', line 26

def schema_namespace_map
  @schema_namespace_map
end

#schema_pathString

Local path to look for Avro schemas (.avsc files) in.

Returns:

  • (String)


8
9
10
# File 'lib/avro_gen/configuration.rb', line 8

def schema_path
  @schema_path
end

#use_full_namespaceBoolean

Set to true to generate folders matching the last part of the schema namespace.

Returns:

  • (Boolean)


20
21
22
# File 'lib/avro_gen/configuration.rb', line 20

def use_full_namespace
  @use_full_namespace
end

Instance Method Details

#reset!void

This method returns an undefined value.

Restore all settings to their defaults.



38
39
40
41
42
43
44
45
# File 'lib/avro_gen/configuration.rb', line 38

def reset!
  @schema_path = nil
  @generated_class_path = 'app/lib/schema_classes'
  @nest_child_schemas = true
  @use_full_namespace = false
  @schema_namespace_map = {}
  @root_module = 'Schemas'
end