Class: EnrichmentDb::Language::Datum
- Inherits:
-
DatumModel
- Object
- DatumModel
- EnrichmentDb::Language::Datum
- Defined in:
- lib/enrichment_db/language/datum.rb
Instance Attribute Summary
Attributes inherited from DatumModel
Class Method Summary collapse
Methods inherited from DatumModel
all, by_id, by_lambda, #initialize, lazy_attr_reader
Constructor Details
This class inherits a constructor from EnrichmentDb::DatumModel
Class Method Details
.format_result(result) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/enrichment_db/language/datum.rb', line 4 def self.format_result(result) if result.size > 0 puts "Found #{result.size} object/s" result.collect do |h| h.delete('id') h end.sort_by do |h| h['value'] end.each_with_object({}) do |record, h| h[record.fetch('value')] ||= [] h[record.fetch('value')] << record.fetch('language') end.each_with_object({}) do |(key, values), h| h[key] = values.join('|') end else puts "Nothing found" end end |