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.
21 22 23 |
# File 'lib/utils/extract_urls.rb', line 21 def initialize(lnks) self.links = lnks end |
Instance Attribute Details
#links ⇒ Object
Returns the value of attribute links.
19 20 21 |
# File 'lib/utils/extract_urls.rb', line 19 def links @links end |
Instance Method Details
#add_archive_org ⇒ Object
34 35 36 37 |
# File 'lib/utils/extract_urls.rb', line 34 def add_archive_org links.map! { |l| 'https://archive.org' + l } self end |
#add_leading_dash ⇒ Object
39 40 41 42 |
# File 'lib/utils/extract_urls.rb', line 39 def add_leading_dash links.map! { |l| '- ' + l } self end |
#add_links(lnks) ⇒ Object
25 26 27 |
# File 'lib/utils/extract_urls.rb', line 25 def add_links(lnks) self.links << lnks end |
#only_mp3s ⇒ Object
29 30 31 32 |
# File 'lib/utils/extract_urls.rb', line 29 def only_mp3s links.delete_if { |l| !l.match(/\.mp3$/i) } self end |
#yaml_formatted ⇒ Object
44 45 46 |
# File 'lib/utils/extract_urls.rb', line 44 def yaml_formatted only_mp3s.add_archive_org.add_leading_dash.links end |