Class: NdrImport::Avro::Table
- Defined in:
- lib/ndr_import/avro/table.rb
Overview
Syntatic sugar to ensure ‘header_lines` and `footer_lines` are 1 and 0 respectively. All other Table logic is inherited from `NdrImport::Table`
Instance Attribute Summary
Attributes inherited from Table
Class Method Summary collapse
- .all_valid_options ⇒ Object
-
.from_schema(safe_path) ⇒ Object
Scaffold an ‘NdrImport::Avro::Table` instance from avro schema file.
Instance Method Summary collapse
Methods inherited from Table
#all_valid_options, #encode_with, #header_valid?, #initialize, #match, #process_line, #transform, #transform_line
Constructor Details
This class inherits a constructor from NdrImport::Table
Class Method Details
.all_valid_options ⇒ Object
20 21 22 |
# File 'lib/ndr_import/avro/table.rb', line 20 def self. super - %w[delimiter header_lines footer_lines] end |
.from_schema(safe_path) ⇒ Object
Scaffold an ‘NdrImport::Avro::Table` instance from avro schema file
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ndr_import/avro/table.rb', line 9 def self.from_schema(safe_path) raise SecurityError, "#{safe_path} is not a SafePath" unless safe_path.is_a? SafePath table_columns = columns_from(::Avro::Schema.parse(::File.open(safe_path))) file_name = SafeFile.basename(safe_path).sub(/\.avsc\z/, '.avro') new(filename_pattern: "/#{file_name}\\z/", klass: 'ExampleKlass', columns: table_columns) end |
Instance Method Details
#footer_lines ⇒ Object
28 29 30 |
# File 'lib/ndr_import/avro/table.rb', line 28 def 0 end |
#header_lines ⇒ Object
24 25 26 |
# File 'lib/ndr_import/avro/table.rb', line 24 def header_lines 1 end |