Class: ThinkingSphinx::Search::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/search/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search, configuration = nil) ⇒ Context

Returns a new instance of Context



4
5
6
7
8
9
10
11
# File 'lib/thinking_sphinx/search/context.rb', line 4

def initialize(search, configuration = nil)
  @search        = search
  @configuration = configuration || ThinkingSphinx::Configuration.instance
  @memory        = {
    :results => [],
    :panes   => ThinkingSphinx::Configuration::Defaults::PANES.clone
  }
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration



2
3
4
# File 'lib/thinking_sphinx/search/context.rb', line 2

def configuration
  @configuration
end

#searchObject (readonly)

Returns the value of attribute search



2
3
4
# File 'lib/thinking_sphinx/search/context.rb', line 2

def search
  @search
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
# File 'lib/thinking_sphinx/search/context.rb', line 13

def [](key)
  @memory[key]
end

#[]=(key, value) ⇒ Object



17
18
19
# File 'lib/thinking_sphinx/search/context.rb', line 17

def []=(key, value)
  @memory[key] = value
end

#log(notification, message, &block) ⇒ Object



21
22
23
24
25
# File 'lib/thinking_sphinx/search/context.rb', line 21

def log(notification, message, &block)
  ActiveSupport::Notifications.instrument(
    "#{notification}.thinking_sphinx", notification => message, &block
  )
end