class HsdsTransformer::Runner

Constants

VALID_CUSTOM_TRANSFORMERS

Public Class Methods

custom_transformer(custom) click to toggle source
# File lib/hsds_transformer/runner.rb, line 27
def self.custom_transformer(custom)
  klass = "HsdsTransformer::" + custom
  Object.const_get(klass)
end
run(args) click to toggle source

Args: input_path - indicates the dir containing the input data files output_path - indicates the dir you want the resulting HSDS files to go include_custom - Default: false - indicates that the final output CSVs should include the non-HSDS columns that the original input CSVs had zip_output - Default: false - indicates whether you want the output to be zipped into a single datapackage.zip custom_transformer - Default: nil - indicates the custom transformer class you want to use. This arg does not get passed to transformer classes

# File lib/hsds_transformer/runner.rb, line 12
def self.run(args)
  custom = args.delete(:custom_transformer)
  validate_custom(custom)

  transformer = custom ? custom_transformer(custom) : BaseTransformer

  transformer.run(args)
end
validate_custom(custom) click to toggle source
# File lib/hsds_transformer/runner.rb, line 21
def self.validate_custom(custom)
  if custom && !VALID_CUSTOM_TRANSFORMERS.include?(custom)
    raise InvalidCustomTransformerException
  end
end