Class: Writer::Fetcher::Microdata::PersonUser

Inherits:
Object
  • Object
show all
Defined in:
lib/writer/fetcher-microdata/person_user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(the_source) ⇒ PersonUser

Returns a new instance of PersonUser.



7
8
9
# File 'lib/writer/fetcher-microdata/person_user.rb', line 7

def initialize the_source
  @source = the_source
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source.



5
6
7
# File 'lib/writer/fetcher-microdata/person_user.rb', line 5

def source
  @source
end

Instance Method Details

#hashObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/writer/fetcher-microdata/person_user.rb', line 11

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