Method: Hypermicrodata.to_json

Defined in:
lib/hypermicrodata.rb

.to_json(location, encoding = nil) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/hypermicrodata.rb', line 30

def self.to_json(location, encoding = nil)
  items = get_items(location, encoding)
  hash = {}
  hash[:items] = items.map do |item|
    item.to_hash
  end
  JSON.pretty_generate hash
end