Module: ActiveFacets

Defined in:
lib/active_facets/config.rb,
lib/active_facets.rb,
lib/active_facets/filter.rb,
lib/active_facets/version.rb,
lib/active_facets/document_cache.rb,
lib/active_facets/serializer/base.rb,
lib/active_facets/resource_manager.rb,
lib/active_facets/serializer/facade.rb,
lib/active_facets/errors/lookup_error.rb,
lib/active_facets/acts_as_active_facet.rb,
lib/active_facets/errors/attribute_error.rb,
lib/active_facets/errors/configuration_error.rb,
lib/rails/generators/active_facets/install/install_generator.rb

Overview

TODO –jdc, change serializer scoped_includes, as_json & from_hash to be generic and add voerrides in initializer for www

when serializing, access cattr to determine method name to invoke

add tests for the this module

Defined Under Namespace

Modules: ActsAsActiveFacet, Errors, Generators, Serializer Classes: Config, DocumentCache, Filter, ResourceManager

Constant Summary collapse

VERSION =
"1.2.5"

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (ActiveFacets)

    the object that the method was called on



53
54
55
56
# File 'lib/active_facets.rb', line 53

def self.configure
  yield(self)
  ActiveRecord::Base.acts_as_active_facet if ActiveFacets.acts_as_active_facet_enabled
end

.deep_copy(o) ⇒ Object



88
89
90
# File 'lib/active_facets.rb', line 88

def self.deep_copy(o)
  Marshal.load(Marshal.dump(o))
end

.fields_from_options(options) ⇒ Object



70
71
72
# File 'lib/active_facets.rb', line 70

def self.fields_from_options(options)
  (options[ActiveFacets.opts_key] || {})[ActiveFacets.fields_key]
end

.global_filter(name) ⇒ Object



58
59
60
# File 'lib/active_facets.rb', line 58

def self.global_filter(name)
  ActiveFacets::Filter.register_global(name, Proc.new)
end

.options_with_fields(options, fields) ⇒ Object



74
75
76
77
# File 'lib/active_facets.rb', line 74

def self.options_with_fields(options, fields)
  (options[ActiveFacets.opts_key] ||= {})[ActiveFacets.fields_key] = fields
  options
end

.resource_mapperObject



62
63
64
# File 'lib/active_facets.rb', line 62

def self.resource_mapper
  ActiveFacets::ResourceManager.resource_mapper = Proc.new
end

.restore_opts_after(options, key, value) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/active_facets.rb', line 79

def self.restore_opts_after(options, key, value)
  opts = (options[ActiveFacets.opts_key] ||= {})
  old = opts[key]
  opts[key] = value
  yield
ensure
  opts[key] = old
end

.serializer_mapperObject



66
67
68
# File 'lib/active_facets.rb', line 66

def self.serializer_mapper
  ActiveFacets::ResourceManager.serializer_mapper = Proc.new
end