Class: ArchiveOrgLinkGrabber::Links
Instance Attribute Summary collapse
-
#links ⇒ Object
Returns the value of attribute links.
Instance Method Summary collapse
- #add_archive_org ⇒ Object
- #add_leading_dash ⇒ Object
- #add_links(lnks) ⇒ Object
-
#initialize(lnks) ⇒ Links
constructor
A new instance of Links.
- #only_mp3s ⇒ Object
- #yaml_formatted ⇒ Object
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
#links ⇒ Object
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_org ⇒ Object
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_dash ⇒ Object
42 43 44 45 |
# File 'lib/utils/extract_urls.rb', line 42 def add_leading_dash links.map! { |l| '- ' + l } self end |
#add_links(lnks) ⇒ Object
28 29 30 |
# File 'lib/utils/extract_urls.rb', line 28 def add_links(lnks) self.links << lnks end |
#only_mp3s ⇒ Object
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_formatted ⇒ Object
47 48 49 |
# File 'lib/utils/extract_urls.rb', line 47 def yaml_formatted only_mp3s.add_archive_org.add_leading_dash.links end |