Class: Jekyll::WebmentionIO::WebmentionItem

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/webmention_io/webmention_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mention, site) ⇒ WebmentionItem

Returns a new instance of WebmentionItem.



15
16
17
18
19
20
21
22
23
# File 'lib/jekyll/webmention_io/webmention_item.rb', line 15

def initialize(mention, site)
  @raw = mention
  @site = site

  @uri = determine_uri
  @source = determine_source
  @id = determine_id
  @type = determine_type
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



13
14
15
# File 'lib/jekyll/webmention_io/webmention_item.rb', line 13

def hash
  @hash
end

#idObject (readonly)

Returns the value of attribute id.



13
14
15
# File 'lib/jekyll/webmention_io/webmention_item.rb', line 13

def id
  @id
end

Instance Method Details

#to_hashObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/jekyll/webmention_io/webmention_item.rb', line 25

def to_hash
  gather_content

  the_hash = {
    "id"      => @id,
    "uri"     => @uri,
    "source"  => @source,
    "pubdate" => @pubdate,
    "raw"     => @raw,
    "author"  => @author,
    "type"    => @type,
  }

  the_hash["title"] = @title if @title
  the_hash["content"] = @content || ""

  the_hash
end