Class: AtomFeed::AtomLink

Inherits:
Object show all
Defined in:
lib/atom_feed/atom_link.rb

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ AtomLink

Initializes the link.



4
5
6
# File 'lib/atom_feed/atom_link.rb', line 4

def initialize(node)
  @node = node
end

Instance Method Details

#alternate?Boolean

An alternate represenation of the entry or feed, e.g. a permalink to the HTML version of the resource?

Returns:

  • (Boolean)


22
23
24
# File 'lib/atom_feed/atom_link.rb', line 22

def alternate?
  self.rel == "alternate"
end

#edit?Boolean

Link to edit?

Returns:

  • (Boolean)


48
49
50
# File 'lib/atom_feed/atom_link.rb', line 48

def edit?
  self.rel == "edit"
end

#enclosure?Boolean

A related resource (potentially large in size and might need special handling), e.g. an image or video recording?

Returns:

  • (Boolean)


28
29
30
# File 'lib/atom_feed/atom_link.rb', line 28

def enclosure?
  self.rel == "enclosure"
end

#first?Boolean

Reference to first search result in OpenSearch (OpenSearch extension)?

Returns:

  • (Boolean)


58
59
60
# File 'lib/atom_feed/atom_link.rb', line 58

def first?
  self.rel == "first"
end

#hrefObject

The URI of the referenced resource (required).



9
10
11
# File 'lib/atom_feed/atom_link.rb', line 9

def href
  @node["href"]
end

#hreflangObject

Language of the referenced resource (optional)



83
84
85
# File 'lib/atom_feed/atom_link.rb', line 83

def hreflang
  @node["hreflang"]
end

#last?Boolean

Reference to last search result in OpenSearch (OpenSearch extension)?

Returns:

  • (Boolean)


73
74
75
# File 'lib/atom_feed/atom_link.rb', line 73

def last?
  self.rel == "last"
end

#lengthObject

Length of the resource in bytes (optional).



93
94
95
# File 'lib/atom_feed/atom_link.rb', line 93

def length
  @node["length"]
end

#next?Boolean

Reference to next search results in OpenSearch (OpenSearch extension)?

Returns:

  • (Boolean)


68
69
70
# File 'lib/atom_feed/atom_link.rb', line 68

def next?
  self.rel == "next"
end

#previous?Boolean

Reference to previous search results in OpenSearch (OpenSearch extension)?

Returns:

  • (Boolean)


63
64
65
# File 'lib/atom_feed/atom_link.rb', line 63

def previous?
  self.rel == "previous"
end

#relObject

A single link relationship type (optional). It could be a full URI or one of some predefined values. Returns “alternate” as default.



16
17
18
# File 'lib/atom_feed/atom_link.rb', line 16

def rel
  @node["rel"] || "alternate"
end

#related?Boolean

A document related to the feed or entry?

Returns:

  • (Boolean)


33
34
35
# File 'lib/atom_feed/atom_link.rb', line 33

def related?
  self.rel == "related"
end

#search?Boolean

Reference to OpenSearch description document (OpenSearch extension)?

Returns:

  • (Boolean)


53
54
55
# File 'lib/atom_feed/atom_link.rb', line 53

def search?
  self.rel == "search"
end

#self?Boolean

The feed itself?

Returns:

  • (Boolean)


38
39
40
# File 'lib/atom_feed/atom_link.rb', line 38

def self?
  self.rel == "self"
end

#titleObject

Human readable information about the link (optional)



88
89
90
# File 'lib/atom_feed/atom_link.rb', line 88

def title
  @node["title"]
end

#typeObject

Media type of the resource (optional)



78
79
80
# File 'lib/atom_feed/atom_link.rb', line 78

def type
  @node["type"]
end

#via?Boolean

Source of the information provided in the entry?

Returns:

  • (Boolean)


43
44
45
# File 'lib/atom_feed/atom_link.rb', line 43

def via?
  self.rel == "via"
end