Sha256: 2c9beecd3a4fed81c699418daf4870dc55fea6f3079f58050507a573e02b1704
Contents?: true
Size: 930 Bytes
Versions: 22
Compression:
Stored size: 930 Bytes
Contents
# DEPRECATED. Just write the logic into a custom Decorator yourself. # See wiki on decorators. # 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
22 entries across 22 versions & 1 rubygems