Sha256: cdc048687ab3484ef10ff8d371b8cc84f993f48a4ad71f9d96ba005b309bcde0

Contents?: true

Size: 662 Bytes

Versions: 4

Compression:

Stored size: 662 Bytes

Contents

module Sunspot
  module Search
    class StatRow
      attr_reader :stat_field, :value
      attr_writer :instance #:nodoc:

      def initialize(stat_field, value, stat) #:nodoc:
        @stat_field, @value, @stat = stat_field, value, stat
      end

      # 
      # Return the instance referenced by this stat row. Only valid for field
      # stats whose fields are defined with the :references key.
      #
      
      def instance
        if !defined?(@instance)
          @stat.populate_instances
        end
        @instance
      end

      def inspect
        "<Sunspot::Search::StatRow:#{stat_field.inspect} (#{value})>"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sunspot_stats-0.0.5 lib/search/stat_row.rb
sunspot_stats-0.0.4 lib/search/stat_row.rb
sunspot_stats-0.0.3 lib/search/stat_row.rb
sunspot_stats-0.0.2 lib/search/stat_row.rb