Module: Exlibris::Primo::WebService::Request::SearchElements

Included in:
Search
Defined in:
lib/exlibris/primo/web_service/request/search/search_elements.rb

Defined Under Namespace

Modules: ClassAttributes

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Dynamically sets attr_accessors for search_elements



78
79
80
81
82
83
84
85
# File 'lib/exlibris/primo/web_service/request/search/search_elements.rb', line 78

def method_missing(method, *args, &block)
  if search_elements.include?(attributize(method))
    self.class.send :attr_accessor, attributize(method)
    send method, *args, &block
  else
    super
  end
end

Class Method Details

.included(klass) ⇒ Object



6
7
8
9
10
# File 'lib/exlibris/primo/web_service/request/search/search_elements.rb', line 6

def self.included(klass)
  klass.class_eval do
    extend ClassAttributes
  end
end

Instance Method Details

#respond_to?(method, include_private = false) ⇒ Boolean

Tell users that we respond to search elements accessors.

Returns:

  • (Boolean)


90
91
92
# File 'lib/exlibris/primo/web_service/request/search/search_elements.rb', line 90

def respond_to?(method, include_private = false)
  (search_elements.include?(attributize method)) ? true : super
end