Sha256: 9a868ee178f3bad154fa9800bcefda90a0f1c10cb01d6ea492df46afaa61e7fe
Contents?: true
Size: 911 Bytes
Versions: 7
Compression:
Stored size: 911 Bytes
Contents
module Searchlogic class Search module ToYaml def self.included(klass) klass.class_eval do yaml_as "tag:ruby.yaml.org,2002:class" include InstanceMethods end end module InstanceMethods def to_yaml( opts = {} ) YAML::quick_emit( self, opts ) do |out| out.map("tag:ruby.yaml.org,2002:object:Searchlogic::Search") do |map| map.add('class_name', klass.name) map.add('current_scope', current_scope) map.add('conditions', conditions) end end end def yaml_initialize(taguri, attributes = {}) self.klass = attributes["class_name"].constantize self.current_scope = attributes["current_scope"] @conditions ||= {} self.conditions = attributes["conditions"] end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems