Sha256: d30e4b8de618df4c46a8bcd0cdee5ea25a6e46a1e5b3dd40141a25227ae29276

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module BentoSearch
  # Represents an 'additional link' held in BentoSearch::ResultItem#other_links
  #
  # label, url, other metadata about the link. 
  class Link
    # url is normally a string, but can also be a Hash passed
    # to url_for in the local app. 
    attr_accessor :label, :url
    
    # Used both for HTML links and possibly later Atom. 
    # Must be a string, EITHER a complete URL (representing
    # vocab term), OR a legal short name from 
    # http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#linkTypes    
    attr_accessor :rel
    
    # Array of strings, used for CSS classes on this link, possibly
    # for custom styles/images etc. May be used in non-html link
    # contexts too. 
    attr_accessor :style_classes
    
    # Suggested `target` attribute to render link with as html <a> 
    attr_accessor :target
    
    def initialize(hash = {})
      self.style_classes = []
      
      hash.each_pair do |key, value|
        send("#{key}=", value)
      end            
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bento_search-0.9.0 app/models/bento_search/link.rb