module Microdata

Constants

VERSION

Public Class Methods

get_items(location) click to toggle source

PROPERTY_VALUES = {

meta:     'content',
audio:    'src',
embed:    'src',
iframe:   'src',
img:      'src',
source:   'src',
video:    'src',
a:        'href',
area:     'href',
link:     'href',
object:   'data',
time:     'datetime'

}

# File lib/microdata.rb, line 27
def self.get_items(location)
  content = open(location)
  page_url = location
  Microdata::Document.new(content, page_url).extract_items
end
to_json(location) click to toggle source
# File lib/microdata.rb, line 33
def self.to_json(location)
  items = get_items(location)
  hash = {}
  hash[:items] = items.map do |item|
    item.to_hash
  end
  JSON.pretty_generate hash
end