Class: ArchiveOrgLinkGrabber::Links

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/extract_urls.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lnks) ⇒ Links

Returns a new instance of Links.



24
25
26
# File 'lib/utils/extract_urls.rb', line 24

def initialize(lnks)
  self.links = lnks
end

Instance Attribute Details

Returns the value of attribute links.



22
23
24
# File 'lib/utils/extract_urls.rb', line 22

def links
  @links
end

Instance Method Details

#add_archive_orgObject



37
38
39
40
# File 'lib/utils/extract_urls.rb', line 37

def add_archive_org
  links.map! { |l| 'https://archive.org' + l }
  self
end

#add_leading_dashObject



42
43
44
45
# File 'lib/utils/extract_urls.rb', line 42

def add_leading_dash
  links.map! { |l| '- ' + l }
  self
end


28
29
30
# File 'lib/utils/extract_urls.rb', line 28

def add_links(lnks)
  self.links << lnks
end

#only_mp3sObject



32
33
34
35
# File 'lib/utils/extract_urls.rb', line 32

def only_mp3s
  links.delete_if { |l| !l.match(/\.mp3$/i) }
  self
end

#yaml_formattedObject



47
48
49
# File 'lib/utils/extract_urls.rb', line 47

def yaml_formatted
  only_mp3s.add_archive_org.add_leading_dash.links
end