class Hypermicrodata::Serializer::Base
Public Class Methods
new(document, location = nil, profile_path = nil)
click to toggle source
# File lib/hypermicrodata/serializer/base.rb, line 4 def initialize(document, location = nil, profile_path = nil) @document = document @location = location @profile_path = profile_path end
Public Instance Methods
serialize()
click to toggle source
# File lib/hypermicrodata/serializer/base.rb, line 14 def serialize # return hash or array suitable for application/json if @document.items @document.items.map(&:to_hash) else [] end end
to_json(options = {})
click to toggle source
# File lib/hypermicrodata/serializer/base.rb, line 10 def to_json(options = {}) MultiJson.dump(serialize, options) end