Refactoring the serializers to be modules instead of classes, since they never get instantiated.

This commit is contained in:
Ben Atkins 2013-01-23 15:56:10 -05:00
parent afa58117f5
commit 05301e586e
3 changed files with 3 additions and 3 deletions

View File

@ -749,7 +749,7 @@ By default, PaperTrail stores your changes as a YAML dump. You can override this
>> PaperTrail.config.serializer = MyCustomSerializer
```
The serializer needs to be a class that has a `load` and `dump` class method. These serializers are included in the gem for your convenience:
A valid serializer is a `module` (or `class`) that defines a `load` and `dump` method. These serializers are included in the gem for your convenience:
* [Yaml](https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/serializers/yaml.rb) - Default
* [Json](https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/serializers/json.rb)

View File

@ -2,7 +2,7 @@ require 'active_support/json'
module PaperTrail
module Serializers
class Json
module Json
def self.load(string)
ActiveSupport::JSON.decode string
end

View File

@ -2,7 +2,7 @@ require 'yaml'
module PaperTrail
module Serializers
class Yaml
module Yaml
def self.load(string)
YAML.load string
end