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

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

Instance Method Summary collapse

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



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

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



29
30
31
32
33
34
# File 'lib/searchlogic/search/to_yaml.rb', line 29

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