Sha256: 4abd4fe0357021c8aa9cf82b07e66c951ff5ff2129d76f4d856ca0d66bb12b03
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
module Chronicle module ETL module Registry # Records details about a connector such as its provider and a description class ConnectorRegistration attr_accessor :identifier, :provider, :klass, :description def initialize(klass) @klass = klass end def phase if klass.ancestors.include? Chronicle::ETL::Extractor :extractor elsif klass.ancestors.include? Chronicle::ETL::Transformer :transformer elsif klass.ancestors.include? Chronicle::ETL::Loader :loader end end def to_s "#{phase}-#{identifier}" end def built_in? @klass.to_s.include? 'Chronicle::ETL' end def klass_name @klass.to_s end def identifier @identifier || @klass.to_s.split('::').last.gsub!(/(Extractor$|Loader$|Transformer$)/, '').downcase end def description @description || @klass.to_s.split('::').last end def provider @provider || (built_in? ? 'chronicle' : '') end def descriptive_phrase prefix = case phase when :extractor "Extracts from" when :transformer "Transforms" when :loader "Loads to" end "#{prefix} #{description}" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chronicle-etl-0.3.1 | lib/chronicle/etl/registry/connector_registration.rb |
chronicle-etl-0.3.0 | lib/chronicle/etl/registry/connector_registration.rb |