Class: Dbla::Response::Facets::FacetItem

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ FacetItem

Returns a new instance of FacetItem.



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/dbla/response/facets.rb', line 41

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



58
59
60
# File 'lib/dbla/response/facets.rb', line 58

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

#labelObject



54
55
56
# File 'lib/dbla/response/facets.rb', line 54

def label
  super || value
end