Class: Sunspot::SessionProxy::AbstractSessionProxy

Inherits:
Object
  • Object
show all
Defined in:
sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb

Overview

:nodoc:

Direct Known Subclasses

MasterSlaveSessionProxy, ShardingSessionProxy, SilentFailSessionProxy, ThreadLocalSessionProxy

Class Method Summary (collapse)

Class Method Details

+ (Object) delegate(*args)



5
6
7
8
9
10
11
12
13
14
15
# File 'sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb', line 5

def delegate(*args)
  options = Util.extract_options_from(args)
  delegate = options[:to]
  args.each do |method|
    module_eval(<<-RUBY, __FILE__, __LINE__ + 1)
      def #{method}(*args, &block)
        #{delegate}.#{method}(*args, &block)
      end
    RUBY
  end
end

+ (Object) not_supported(*methods)



17
18
19
20
21
22
23
24
25
# File 'sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb', line 17

def not_supported(*methods)
  methods.each do |method|
    module_eval(<<-RUBY, __FILE__, __LINE__ + 1)
      def #{method}(*args, &block)
        raise NotSupportedError, "#{name} does not support #{method.inspect}"
      end
    RUBY
  end
end