Class: Europeana::Blacklight::Response::Facets::FacetItem

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/europeana/blacklight/response/facets.rb

Overview

represents a facet value; which is a field value and its hit count

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ FacetItem

Returns a new instance of FacetItem.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/europeana/blacklight/response/facets.rb', line 15

def initialize(*args)
  options = args.extract_options!

  # Backwards-compat method signature
  value = args.shift
  hits = args.shift

  options[:value] = value if value
  options[:hits] = hits if hits

  super(options)
end

Instance Method Details

#as_json(props = nil) ⇒ Object



32
33
34
# File 'lib/europeana/blacklight/response/facets.rb', line 32

def as_json(props = nil)
  table.as_json(props)
end

#labelObject



28
29
30
# File 'lib/europeana/blacklight/response/facets.rb', line 28

def label
  super || value
end