Sha256: ae7e1972bca2e5cd9117a69622c3acddf1ebd4f111eb927a7b8b94685a12a29d
Contents?: true
Size: 962 Bytes
Versions: 2
Compression:
Stored size: 962 Bytes
Contents
require 'active_support/hash_with_indifferent_access' module DirModel module Export class AggregateDir include Utils attr_reader :context, :dir_path # @param [Export] export_model export model class def initialize(context={}) @context = context.to_h.symbolize_keys @dir_path = Dir.mktmpdir end # Add a row_model to the # @param [] source_model the source model of the export file model # @param [Hash] context the extra context given to the instance of the file model def append_model(export_dir_model_class, source_model, context={}) source_path = export_dir_model_class.new(source_model, context.reverse_merge(self.context)).path FileUtils.cp_r Dir.glob("#{source_path}/*"), dir_path end def generate yield self self end def files Dir["#{@dir_path}/**/*"].select { |f| File.file?(f) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dir_model-0.7.1 | lib/dir_model/export/aggregate_dir.rb |
dir_model-0.7.0 | lib/dir_model/export/aggregate_dir.rb |