Method: MetaContent::Sanitizer#from_database

Defined in:
lib/meta_content/sanitizer.rb

#from_database(raw_results) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/meta_content/sanitizer.rb', line 8

def from_database(raw_results)
  sanitized_results = HashWithIndifferentAccess.new
  raw_results.each do |namespace, results|
    results.each do |k,v|
      options = schema[namespace] || {}
      options = options[k]
      next unless options
      sanitized_results[namespace] ||= {}
      sanitized_results[namespace][k] = sanitize_from_database(v, options[:type] || :string)
    end
  end
  sanitized_results
end