Class: Sufia::Statistics::TermQuery::Result
- Inherits:
-
Object
- Object
- Sufia::Statistics::TermQuery::Result
- Defined in:
- app/services/sufia/statistics/term_query.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#==(other) ⇒ Object
This enables hash equivalence.
-
#as_json(opts) ⇒ Object
Allows us to create a Flot charts pie-graph.
-
#initialize(label, value) ⇒ Result
constructor
A new instance of Result.
- #label ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(label, value) ⇒ Result
Returns a new instance of Result.
35 36 37 |
# File 'app/services/sufia/statistics/term_query.rb', line 35 def initialize(label, value) @data = { label: label, data: value } end |
Class Method Details
.build(rows) ⇒ Object
31 32 33 |
# File 'app/services/sufia/statistics/term_query.rb', line 31 def self.build(rows) rows.map { |row| Result.new(*row) } end |
Instance Method Details
#==(other) ⇒ Object
This enables hash equivalence
48 49 50 |
# File 'app/services/sufia/statistics/term_query.rb', line 48 def ==(other) other == @data end |
#as_json(opts) ⇒ Object
Allows us to create a Flot charts pie-graph
53 54 55 |
# File 'app/services/sufia/statistics/term_query.rb', line 53 def as_json(opts) @data.as_json(opts) end |
#label ⇒ Object
39 40 41 |
# File 'app/services/sufia/statistics/term_query.rb', line 39 def label @data[:label] end |
#value ⇒ Object
43 44 45 |
# File 'app/services/sufia/statistics/term_query.rb', line 43 def value @data[:data] end |