Class: BerkeleyLibrary::AV::Metadata::Link

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/berkeley_library/av/metadata/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body:, url:) ⇒ Link

Returns a new instance of Link.



9
10
11
12
# File 'lib/berkeley_library/av/metadata/link.rb', line 9

def initialize(body:, url:)
  @body = body
  @url = url
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



7
8
9
# File 'lib/berkeley_library/av/metadata/link.rb', line 7

def body
  @body
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/berkeley_library/av/metadata/link.rb', line 7

def url
  @url
end

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/berkeley_library/av/metadata/link.rb', line 18

def <=>(other)
  return unless other
  return 0 if equal?(other)
  return unless other.is_a?(Link)

  to_s <=> other.to_s
end

#to_sObject



14
15
16
# File 'lib/berkeley_library/av/metadata/link.rb', line 14

def to_s
  "[#{body}](#{url})"
end