Sha256: f665673222c1e98f8e7d0e58fda63c9262a72adc759123fdf74b5e91819021f2

Contents?: true

Size: 741 Bytes

Versions: 5

Compression:

Stored size: 741 Bytes

Contents

require File.dirname(__FILE__) + '/shared'

module DataCatalog
  module ImporterFramework
    class Handler
      include Shared
      
      def initialize(options)
        @options = options
        @counter = {}
        [:source, :organization].each do |resource|
          FileUtils.mkdir_p(folder(resource))
          @counter[resource] = 1
        end
      end
      
      def source(data)
        write_data(:source, data)
      end
      
      def organization(data)
        write_data(:organization, data)
      end
      
      def write_data(resource, data)
        file = folder(resource) + ("/%08i.yml" % @counter[resource])
        Utility.write_yaml(file, data)
        @counter[resource] += 1
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
datacatalog-importer-0.3.0 lib/handler.rb
datacatalog-importer-0.2.3 lib/handler.rb
datacatalog-importer-0.2.2 lib/handler.rb
datacatalog-importer-0.2.1 lib/handler.rb
datacatalog-importer-0.2.0 lib/handler.rb