Sha256: 23904de6e6828e2ec9ac2640cd832edac8ec5055370c492b8e719c30c6affe50
Contents?: true
Size: 830 Bytes
Versions: 3
Compression:
Stored size: 830 Bytes
Contents
# Example of an Item Decorator that replaces the main 'link' # with an openurl. # # 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::OpenurlMainLink[:base_url => "http://resolve.somewhere.edu/foo", :extra_query => "&foo=bar"] ] # module BentoSearch::OpenurlMainLink def self.[](options) base_url = options[:base_url] extra_query = options[:extra_query] || "" Module.new do define_method :link do if (ou = to_openurl) "#{base_url}?#{ou.kev}#{extra_query}" else nil end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems