instiki/vendor/rails/activerecord/lib/active_record/wrappers/yaml_wrapper.rb

15 lines
396 B
Ruby
Raw Normal View History

2007-01-22 14:43:50 +01:00
require 'yaml'
module ActiveRecord
module Wrappings #:nodoc:
class YamlWrapper < AbstractWrapper #:nodoc:
def wrap(attribute) attribute.to_yaml end
def unwrap(attribute) YAML::load(attribute) end
end
module ClassMethods #:nodoc:
# Wraps the attribute in Yaml encoding
def wrap_in_yaml(*attributes) wrap_with(YamlWrapper, attributes) end
end
end
end