Class: Sunspot::SessionProxy::AbstractSessionProxy

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

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.delegate(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File '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

.not_supported(*methods) ⇒ Object



17
18
19
20
21
22
23
24
25
# File '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