Sha256: e4c5c01b3d63f267b5650ef7d8290f90e63b1f9782951f546ea5688d12c1aaf2

Contents?: true

Size: 610 Bytes

Versions: 71

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

module ActionText
  module Serialization
    extend ActiveSupport::Concern

    class_methods do
      def load(content)
        new(content) if content
      end

      def dump(content)
        case content
        when nil
          nil
        when self
          content.to_html
        when ActionText::RichText
          content.body.to_html
        else
          new(content).to_html
        end
      end
    end

    # Marshal compatibility

    class_methods do
      alias_method :_load, :load
    end

    def _dump(*)
      self.class.dump(self)
    end
  end
end

Version data entries

71 entries across 66 versions & 6 rubygems

Version Path
actiontext-7.1.3.2 lib/action_text/serialization.rb
actiontext-7.1.3.1 lib/action_text/serialization.rb
actiontext-7.0.8.1 lib/action_text/serialization.rb
actiontext-6.1.7.7 lib/action_text/serialization.rb
actiontext-7.1.3 lib/action_text/serialization.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actiontext-7.0.3.1/lib/action_text/serialization.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actiontext-6.1.6.1/lib/action_text/serialization.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actiontext-7.0.2.3/lib/action_text/serialization.rb
actiontext-7.1.2 lib/action_text/serialization.rb
actiontext-7.1.1 lib/action_text/serialization.rb
actiontext-7.1.0 lib/action_text/serialization.rb
actiontext-7.1.0.rc2 lib/action_text/serialization.rb
actiontext-7.1.0.rc1 lib/action_text/serialization.rb
actiontext-7.1.0.beta1 lib/action_text/serialization.rb
actiontext-7.0.8 lib/action_text/serialization.rb
actiontext-7.0.7.2 lib/action_text/serialization.rb
actiontext-6.1.7.6 lib/action_text/serialization.rb
actiontext-7.0.7.1 lib/action_text/serialization.rb
actiontext-6.1.7.5 lib/action_text/serialization.rb
actiontext-7.0.7 lib/action_text/serialization.rb