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.3"

Class Method Summary collapse

Class Method Details

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

Yields:

  • (_self)

Yield Parameters:

  • _self (ActiveFacets)

    the object that the method was called on



51
52
53
54
# File 'lib/active_facets.rb', line 51

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

.deep_copy(o) ⇒ Object



86
87
88
# File 'lib/active_facets.rb', line 86

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

.fields_from_options(options) ⇒ Object



68
69
70
# File 'lib/active_facets.rb', line 68

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

.global_filter(name) ⇒ Object



56
57
58
# File 'lib/active_facets.rb', line 56

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

.options_with_fields(options, fields) ⇒ Object



72
73
74
75
# File 'lib/active_facets.rb', line 72

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

.resource_mapperObject



60
61
62
# File 'lib/active_facets.rb', line 60

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

.restore_opts_after(options, key, value) ⇒ Object



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

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



64
65
66
# File 'lib/active_facets.rb', line 64

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