instiki/vendor/rails/activerecord/lib/active_record/wrappers/yaml_wrapper.rb
2007-01-22 07:43:50 -06:00

15 lines
396 B
Ruby

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