Sha256: 1e4697c14b655a399e8e8b98eef8773e59d23d325acc061e787325af23296735

Contents?: true

Size: 397 Bytes

Versions: 43

Compression:

Stored size: 397 Bytes

Contents

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

class JsonizeTinymce < Card::Migration::Core
  def up
    card = Card[:tiny_mce]
    cleaned_rows = card.db_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

43 entries across 43 versions & 1 rubygems

Version Path
card-1.100.0 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.99.6 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.99.5 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.99.4 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.99.3 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.99.2 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.99.1 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.99.0 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.98.3 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.98.2 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.98.1 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.98.0 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.97.0.1 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.97.0 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.96.8 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.96.7 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.96.6 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.96.5 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.96.4 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb
card-1.96.3 db/migrate_core_cards/20130920214038_jsonize_tinymce.rb