berklee-valencia 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/berklee_valencia/cli.rb +4 -0
- data/lib/berklee_valencia/formatter.rb +1 -2
- data/lib/berklee_valencia/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: deb5ed95768b350233449f1e7045a1fec6f61fe8b7665039625d5c9a4b9a1385
|
|
4
|
+
data.tar.gz: 7c8d363e267243df2e4d87b5d040f1091db965bd0c2ec9be22807b6d1632b053
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f77060a9c068d176654f879f353fdefdcc70e2b02746e0aae2a14137b48fd1255367bf1540c7df3a11751d211aa7575165d03e582e2ced016eb67eace0d3254
|
|
7
|
+
data.tar.gz: 072cd06abb62f1e8667935db52e6c16cc214080310d20a785bfd48e0dbfede49f31734becf5ad9ce6fd7583f74b0ad9a5e348a025921e4b5eb7d1cd9064d1f54
|
data/lib/berklee_valencia/cli.rb
CHANGED
|
@@ -35,6 +35,7 @@ class BerkleeValencia::CLI
|
|
|
35
35
|
input = gets.strip.downcase
|
|
36
36
|
if input.to_i.between?(1,2)
|
|
37
37
|
please_wait
|
|
38
|
+
# case statement chosen over if statement for easy future extension
|
|
38
39
|
case input
|
|
39
40
|
when "1"
|
|
40
41
|
list_article_categories
|
|
@@ -47,6 +48,9 @@ class BerkleeValencia::CLI
|
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def list_article_categories
|
|
51
|
+
# if statement used so scrape only happens when necessary
|
|
52
|
+
# (it is necessary when a) a user wishes to view the articles and
|
|
53
|
+
# b) the articles have not already been scraped)
|
|
50
54
|
if BerkleeValencia::ARTICLE.all == []
|
|
51
55
|
BerkleeValencia::SCRAPER.make_articles
|
|
52
56
|
end
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
class Formatter
|
|
2
|
-
|
|
3
2
|
def self.wrap(text, width=80)
|
|
4
3
|
text.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
|
|
5
4
|
end
|
|
@@ -64,7 +63,7 @@ class Formatter
|
|
|
64
63
|
puts "#{urlwrap(" Visit #{(article.related_links.shift)}")}"
|
|
65
64
|
puts "#{urlwrap(" Visit #{(article.related_links.shift)}")}"
|
|
66
65
|
puts " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
|
67
|
-
elsif paragraph.match(/
|
|
66
|
+
elsif paragraph.match(/^Watch|^Listen/i)
|
|
68
67
|
puts " - - - - - - - - - - - - - - - - - Media - - - - - - - - - - - - - - - - - - -"
|
|
69
68
|
puts "#{wrap(paragraph)}"
|
|
70
69
|
puts "#{urlwrap(" Visit #{(article.related_links.shift)}")}"
|