Sha256: 1eb428e306ea57c8a268309a1c806d08c0993e640d4cc5b7bcbea57f65848c4a

Contents?: true

Size: 581 Bytes

Versions: 5

Compression:

Stored size: 581 Bytes

Contents

require 'helper'

class EnrichmentDb::Language::Datum < EnrichmentDb::DatumModel
  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
enrichment_db-0.1.15 lib/enrichment_db/language/datum.rb
enrichment_db-0.1.14 lib/enrichment_db/language/datum.rb
enrichment_db-0.1.13 lib/enrichment_db/language/datum.rb
enrichment_db-0.1.12 lib/enrichment_db/language/datum.rb
enrichment_db-0.1.11 lib/enrichment_db/language/datum.rb