Sha256: dfd65c4187013f1b098f8ca59cdb5491dbba77b05d3519053e1d51eb3d184ca0

Contents?: true

Size: 775 Bytes

Versions: 3

Compression:

Stored size: 775 Bytes

Contents

module Cardio
  class Migration
    class Import
      class ImportData
        # handles card content for import
        module CardContent
          def card_content data
            File.read content_path(data)
          end

          def content_changed? data
            Time.parse(data[:merged]) < File.mtime(content_path(data))
          end

          private

          def write_card_content data, content
            FileUtils.mkpath @card_content_dir unless Dir.exist? @card_content_dir
            File.write content_path(data), content.to_s
          end

          def content_path data
            filename = (data[:key] || data[:name]).to_name.safe_key
            File.join @card_content_dir, filename
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
card-1.104.2 lib/cardio/migration/import/import_data/card_content.rb
card-1.104.1 lib/cardio/migration/import/import_data/card_content.rb
card-1.104.0 lib/cardio/migration/import/import_data/card_content.rb