Class: AvroGen::Configuration
- Inherits:
-
Object
- Object
- AvroGen::Configuration
- Defined in:
- lib/avro_gen/configuration.rb
Overview
Configuration for schema class generation.
Instance Attribute Summary collapse
-
#generated_class_path ⇒ String
Local path for schema classes to be generated in.
-
#nest_child_schemas ⇒ Boolean
Set to false to generate child schemas as their own files.
-
#root_module ⇒ String
The top-level module that generated classes are nested under.
-
#schema_namespace_map ⇒ Hash
Use this option to reduce nesting when using use_full_namespace.
-
#schema_path ⇒ String
Local path to look for Avro schemas (.avsc files) in.
-
#use_full_namespace ⇒ Boolean
Set to true to generate folders matching the last part of the schema namespace.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reset! ⇒ void
Restore all settings to their defaults.
Constructor Details
#initialize ⇒ Configuration
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_path ⇒ String
Local path for schema classes to be generated in.
12 13 14 |
# File 'lib/avro_gen/configuration.rb', line 12 def generated_class_path @generated_class_path end |
#nest_child_schemas ⇒ Boolean
Set to false to generate child schemas as their own files.
16 17 18 |
# File 'lib/avro_gen/configuration.rb', line 16 def nest_child_schemas @nest_child_schemas end |
#root_module ⇒ String
The top-level module that generated classes are nested under.
30 31 32 |
# File 'lib/avro_gen/configuration.rb', line 30 def root_module @root_module end |
#schema_namespace_map ⇒ Hash
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.
26 27 28 |
# File 'lib/avro_gen/configuration.rb', line 26 def schema_namespace_map @schema_namespace_map end |
#schema_path ⇒ String
Local path to look for Avro schemas (.avsc files) in.
8 9 10 |
# File 'lib/avro_gen/configuration.rb', line 8 def schema_path @schema_path end |
#use_full_namespace ⇒ Boolean
Set to true to generate folders matching the last part of the schema namespace.
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 |