Module: Searchlogic::Search::ToYaml::InstanceMethods

Defined in:
lib/searchlogic/search/to_yaml.rb

Instance Method Summary collapse

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/searchlogic/search/to_yaml.rb', line 12

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

#yaml_initialize(taguri, attributes = {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/searchlogic/search/to_yaml.rb', line 22

def yaml_initialize(taguri, attributes = {})
  self.klass = attributes["class_name"].constantize
  self.current_scope = attributes["current_scope"]
  @conditions ||= {}
  self.conditions = attributes["conditions"]
end