Sha256: 1fa4b8977715c270a058831bb87c704a58e23b754e7a015284b3d07fd9436945

Contents?: true

Size: 1.09 KB

Versions: 22

Compression:

Stored size: 1.09 KB

Contents

#  DEPRECATED. Just write the logic into a custom Decorator yourself.
#  See wiki on decorators. 
#
#
# For ebscohost connector, example of an Item Decorator that replaces the main 
# 'link' with an openurl ONLY if there is NOT fulltext avail from EBSCO.  
#
# This example uses crazy metaprogramming to dynamically create
# a module configured with your base url etc. You don't need to use
# crazy method like that; just define your own local decorator doing
# exactly what you need, it's meant to be simple. 
#
#  config.item_decorators = [ BentoSearch::Ebscohost::ConditionalOpenurlMainLink[:base_url => "http://resolve.somewhere.edu/foo", :extra_query => "&foo=bar"] ]
#
module BentoSearch::Ebscohost::ConditionalOpenurlMainLink
  def self.[](options)
    base_url = options[:base_url]
    extra_query = options[:extra_query] || ""
    Module.new do
      
      define_method :link do
        if custom_data["fulltext_formats"]
          super()
        elsif (ou = to_openurl)
          "#{base_url}?#{ou.kev}#{extra_query}"
        else
          nil
        end
      end
      
    end
  end
  
  
  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
bento_search-1.7.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.6.1 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.7.0.beta.1 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.6.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.5.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.4.4 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.4.3 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.4.2 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.3.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.2.2 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.2.1 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.2.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.1.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.0.6 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.0.4 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.0.3 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.0.2 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.0.1 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-1.0.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb
bento_search-0.9.0 app/item_decorators/bento_search/ebscohost/conditional_openurl_main_link.rb