Class: Hyrax::ChartData::Value

Inherits:
Object
  • Object
show all
Defined in:
app/values/hyrax/chart_data.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Value

Returns a new instance of Value.



22
23
24
25
# File 'app/values/hyrax/chart_data.rb', line 22

def initialize(key, value)
  @key = key
  @value = value
end

Instance Method Details

#drilldown_valueObject



35
36
37
38
39
40
41
42
# File 'app/values/hyrax/chart_data.rb', line 35

def drilldown_value
  return nil unless @value.is_a?(Hash)
  {
    name: @key,
    id: @key,
    data: @value.to_a
  }
end

#series_valueObject



27
28
29
30
31
32
33
# File 'app/values/hyrax/chart_data.rb', line 27

def series_value
  if @value.is_a?(Hash)
    drilldown_hash
  else
    series_hash
  end
end