Sha256: f836b8f320e879a8af534899dbe09c4942bfa16b047da3cd080b323361debda3

Contents?: true

Size: 858 Bytes

Versions: 25

Compression:

Stored size: 858 Bytes

Contents

module Exlibris
  module Primo
    # 
    # Primo facet holds the name of the facet
    # and size (often approximate).
    # 
    class Facet
      include Config::Attributes
      include WriteAttributes
      include XmlUtil

      attr_accessor :accurate
      alias accurate? accurate

      def initialize *args
        @raw_xml = args.last.delete(:raw_xml)
        super
      end

      def name
        @name = xml.root["NAME"]
      end

      def display_name
        @display_name ||= (config.facet_labels[name] || name)
      end

      def size
        @size = Integer(xml.root["COUNT"])
      end
      alias :count :size

      def facet_values
        @facet_values ||= xml.root.search("//FACET_VALUES").collect do |facet_value|
          FacetValue.new(:raw_xml => facet_value.to_xml, :facet => self)
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
exlibris-primo-2.1.1 lib/exlibris/primo/facet.rb
exlibris-primo-2.1.0 lib/exlibris/primo/facet.rb
exlibris-primo-2.0.0 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.9 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.8 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.7 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.6 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.5 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.4 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.3 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.2 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.1 lib/exlibris/primo/facet.rb
exlibris-primo-1.1.0 lib/exlibris/primo/facet.rb
exlibris-primo-1.0.11 lib/exlibris/primo/facet.rb
exlibris-primo-1.0.10 lib/exlibris/primo/facet.rb
exlibris-primo-1.0.9 lib/exlibris/primo/facet.rb
exlibris-primo-1.0.8 lib/exlibris/primo/facet.rb
exlibris-primo-1.0.7 lib/exlibris/primo/facet.rb
exlibris-primo-1.0.6 lib/exlibris/primo/facet.rb
exlibris-primo-1.0.5 lib/exlibris/primo/facet.rb