Sha256: 0474bd0e87bd330c5642a70a2e83d2ff30f3b034c92272e7d2dd6fba353f6bd8

Contents?: true

Size: 544 Bytes

Versions: 6

Compression:

Stored size: 544 Bytes

Contents

module Sunspot
  class InstantiatedFacetRow < FacetRow
    attr_writer :instance

    def initialize(value, count, facet)
      super(value, count)
      @facet = facet
    end

    #
    # Get the persistent object referenced by this row's value. Instances are
    # batch-lazy-loaded, which means that for a given facet, all of the
    # instances are loaded the first time any row's instance is requested.
    #
    def instance
      unless defined?(@instance)
        @facet.populate_instances!
      end
      @instance
    end
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
UnderpantsGnome-sunspot-0.9.8.1 lib/sunspot/instantiated_facet_row.rb
kristopher-sunspot-0.9.8 lib/sunspot/instantiated_facet_row.rb
outoftime-sunspot-0.9.7 lib/sunspot/instantiated_facet_row.rb
outoftime-sunspot-0.9.8 lib/sunspot/instantiated_facet_row.rb
sunspot-0.9.8 lib/sunspot/instantiated_facet_row.rb
sunspot-0.9.7 lib/sunspot/instantiated_facet_row.rb