Sha256: 51e5445347d1b3255890b59f0c69b064cbe62bc2ad913d64f4c111f3a291edd2

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module Writer
  module Fetcher
    module Microdata
      class PersonUser
        attr_accessor :source

        def initialize the_source
          @source = the_source
        end

        def hash
          @attributes = @source.attributes

          resp = {
            "type" => [
              @source._type
            ],
            "properties" => {
              "additionalType" => [
                @attributes[:additionalType]
              ],
              "Item#id" => [
                @attributes[:id]
              ],
              "name" => [
                @attributes[:name]
              ],
              "User#dateRegistered" => [
                @attributes[:dateRegistered]
              ],
              "description" => [
                @attributes[:description]
              ],
              "url" => [
                @attributes[:url]
              ]
            }
          }

          resp["properties"].keys.each do |att|
            if resp["properties"]["#{att}"] == [nil]
              resp["properties"].delete "#{att}"
            end
          end
          resp
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fetcher-microdata-0.0.13 lib/writer/fetcher-microdata/person_user.rb
fetcher-microdata-0.0.12 lib/writer/fetcher-microdata/person_user.rb