Sha256: eb054a739cadd4dfebe23ce213f20360a3fbb81bf502e38022d8eec98f583167

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

# frozen_string_literal: true
# # frozen_string_literal: true
# require 'csv'

# module KDsl
#   module Resources
#     module Factories
#       # Base factory for creationg resource_documents
#       # Tightly coupled to the resource using polymorphic composition
#       # Something WRONG, should this be a module include instead of a Forwardable Class?
#       class DocumentFactory
#         extend Forwardable

#         attr_reader :resource

#         def_delegator :resource, :project
#         def_delegator :resource, :content
#         def_delegator :resource, :documents
#         def_delegator :resource, :new_document
#         def_delegator :resource, :add_document
#         def_delegator :resource, :infer_document_key
#         def_delegator :resource, :infer_document_type
#         def_delegator :resource, :infer_document_namespace

#         def initialize(resource, resource_type)
#           @resource = resource
#           resource.resource_type = resource_type
#         end

#         def self.instance(resource, source, file)
#           if source === KDsl::Resources::Resource::SOURCE_FILE
#             extension = File.extname(file).downcase

#             case extension
#             when '.rb'
#               return KDsl::Resources::Factories::RubyDocumentFactory.new(resource)
#             when '.csv'
#               return KDsl::Resources::Factories::CsvDocumentFactory.new(resource)
#             when '.json'
#               return KDsl::Resources::Factories::JsonDocumentFactory.new(resource)
#             when '.yaml'
#               return KDsl::Resources::Factories::YamlDocumentFactory.new(resource)
#             end
#           end

#           return KDsl::Resources::Factories::UnknownDocumentFactory.new(resource)
#         end

#       end
#     end
#   end
# end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
k_manager-0.0.13 lib/k_manager/resources/factories/document_factory.rb