Sha256: a8c34b7f45ad09380862db7009b32b317829d1f44c6e7ca7900a875525788fa1

Contents?: true

Size: 392 Bytes

Versions: 7

Compression:

Stored size: 392 Bytes

Contents

# -*- encoding : utf-8 -*-

class JsonizeTinymce < Card::CoreMigration
  def up
    card = Card[:tiny_mce]
    cleaned_rows = card.content.strip.split(/\s*\,\s+/).map do |row|
      key, val = row.split(/\s*\:\s*/)
      val.gsub!(/\"\s*\+\s*\"/, '')
      val.gsub! "'", '"‚'
      %("#{key}":#{val})
    end
    card.content = %({\n#{cleaned_rows.join ",\n"}\n})
    card.save!
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
card-1.18.6 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.18.5 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.18.4 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.18.3 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.18.2 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.18.1 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.18.0 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb