Sha256: a88feb54fd7a9a80e077207031f969eb2486b4b18c155d70e97fcb51f12ec365

Contents?: true

Size: 525 Bytes

Versions: 6

Compression:

Stored size: 525 Bytes

Contents

require 'yaml'

module PaperTrail
  module Serializers
    module YAML
      extend self # makes all instance methods become module methods as well

      def load(string)
        ::YAML.load string
      end

      def dump(object)
        ::YAML.dump object
      end

      # Returns a SQL condition to be used to match the given field and value in
      # the serialized object.
      def where_object_condition(arel_field, field, value)
        arel_field.matches("%\n#{field}: #{value}\n%")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
paper_trail-3.0.9 lib/paper_trail/serializers/yaml.rb
paper_trail-3.0.8 lib/paper_trail/serializers/yaml.rb
paper_trail-3.0.7 lib/paper_trail/serializers/yaml.rb
paper_trail-4.0.0.beta1 lib/paper_trail/serializers/yaml.rb
paper_trail-3.0.6 lib/paper_trail/serializers/yaml.rb
paper_trail-3.0.5 lib/paper_trail/serializers/yaml.rb