module Writer module Fetcher module Microdata class UserComments attr_accessor :source def initialize the_source self.source = the_source end def hash @attributes = @source.attributes aux = @attributes[:id].split("_") url = "https://www.facebook.com/#{aux[1]}?comment_id=#{aux[2]}" resp = { "type" => [@source._type], "properties" => { "additionalType" => [ @attributes[:additionalType] ], "Item#id" => [ "#{@attributes[:id]}" ], "commentText" => [ @attributes[:commentText] ], "creator" => [ @attributes[:creator].to.hash ], "commentTime" => [ @attributes[:commentTime] ], "url" => [ url ] } } resp["properties"].keys.each do |att| if resp["properties"]["#{att}"] == [nil] resp["properties"].delete "#{att}" end end resp end end end end end