Sha256: 43f79eed54f4f22a4b79e64fe623b3f4739c7f34bce5017d9cda1ca2e56b1421

Contents?: true

Size: 735 Bytes

Versions: 16

Compression:

Stored size: 735 Bytes

Contents

module Endeca
  class Refinement
    extend ClassToProc
    extend Readers

    reader 'DimensionName' => :name,
      'ExpansionLink' => :expansion_link,
      'ContractionLink' => :contraction_link

    integer_reader 'DimensionID' => :id

    reader('DimensionValues' => :dimension_values) do |values|
      values.map(&Dimension) if values
    end

    attr_reader :raw
    def initialize(raw={})
      @raw = raw
    end

    def ==(other)
      id == other.id
    end

    def inspect
      "#<#{self.class}=0x#{self.object_id.to_s(16)} id=#{id} name=#{name.inspect}>"
    end

    def attributes
      (@raw['Dimensions'] || []).first || {}
    end

    def to_params
      expansion_link || contraction_link
    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
primedia-endeca-0.9.10 lib/endeca/refinement.rb
primedia-endeca-0.9.11 lib/endeca/refinement.rb
primedia-endeca-0.9.12 lib/endeca/refinement.rb
primedia-endeca-0.9.13 lib/endeca/refinement.rb
primedia-endeca-0.9.14 lib/endeca/refinement.rb
primedia-endeca-0.9.15 lib/endeca/refinement.rb
primedia-endeca-0.9.16 lib/endeca/refinement.rb
primedia-endeca-0.9.17 lib/endeca/refinement.rb
primedia-endeca-0.9.18 lib/endeca/refinement.rb
primedia-endeca-0.9.19 lib/endeca/refinement.rb
primedia-endeca-0.9.20 lib/endeca/refinement.rb
primedia-endeca-0.9.21 lib/endeca/refinement.rb
primedia-endeca-0.9.22 lib/endeca/refinement.rb
primedia-endeca-0.9.7 lib/endeca/refinement.rb
primedia-endeca-0.9.8 lib/endeca/refinement.rb
primedia-endeca-0.9.9 lib/endeca/refinement.rb