Sha256: d6a7c21777928a80dad360e27ab79c26320e213464b6107147c834f327adde14

Contents?: true

Size: 774 Bytes

Versions: 8

Compression:

Stored size: 774 Bytes

Contents

class Card
  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

8 entries across 8 versions & 1 rubygems

Version Path
card-1.96.8 lib/card/migration/import/import_data/card_content.rb
card-1.96.7 lib/card/migration/import/import_data/card_content.rb
card-1.96.6 lib/card/migration/import/import_data/card_content.rb
card-1.96.5 lib/card/migration/import/import_data/card_content.rb
card-1.96.4 lib/card/migration/import/import_data/card_content.rb
card-1.96.3 lib/card/migration/import/import_data/card_content.rb
card-1.96.2 lib/card/migration/import/import_data/card_content.rb
card-1.96.1 lib/card/migration/import/import_data/card_content.rb