top-headlines 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bff827e260b3751e686d63a37fb1eaa2c98f88b4
4
- data.tar.gz: 28b0b84fca01c465b70cf9149a5c849118fc04ec
3
+ metadata.gz: 2f0e8b3b6cf9a151356422f0fe282c0ec4f13988
4
+ data.tar.gz: 6a06fae11f6722d00c7294b0f226481fbf0f6bad
5
5
  SHA512:
6
- metadata.gz: baf484101522a3388a5421506bb24230f0fd27fec29027df7a28f567ead9486886307f261c3b4e1bf7e6101e92752f0193af0b3d626c7b418e216d0cfbba6974
7
- data.tar.gz: fad4ba49e75d503398de6a8566af83af2e06ac2b7609952b0756a0a23f7f0c57573cf48f333718a1544f7be43c1b939f2bd7397d37c6f8b6afbb2f4aadb36598
6
+ metadata.gz: c6a18208ef7ff9ba6023ce49769195eb33578442e170d216aeeee7edaf7ba322eaae485396cba38848375de933a8807c970fdb5cbd8ec74dba488a5099873436
7
+ data.tar.gz: 576fab8cc7cf1942e968083eb8bacbeb365cf59f2c9787560f846a03fb85ff828267f0f2fe2ca58aee53b4e2ff131b860f6c75e0c35da807af4ca894357f1e63
data/README.md CHANGED
@@ -20,6 +20,8 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ To use the gem, you'll need to `require 'top-headlines'`, instantiate a new TopHeadlines::CLI, and use the .call class method (e.g. `TopHeadlines::CLI.new.call`). You'll then be prompted by on-screen instructions.
24
+
23
25
  In lib/top-headlines/source.rb, users will find a SOURCES hash. Users may add their own favorite news sources to the hash, so that the gem dynamically scrapes even more headlines.
24
26
  ```
25
27
  If you'd like to view how I made the gem, here's a set of videos that captures almost all of it:
@@ -10,7 +10,6 @@ class TopHeadlines::CLI
10
10
  def menu
11
11
  puts "Which source do you want to view? Alternatively, type 'all' to view all headlines or 'exit' to exit!"
12
12
  print "YOUR SELECTION: "
13
- @input = nil
14
13
  while @input != "EXIT" && @num != "EXIT"
15
14
  @input = gets.strip.upcase
16
15
  menu_if_statement
@@ -18,23 +17,23 @@ class TopHeadlines::CLI
18
17
  end
19
18
 
20
19
  def menu_if_statement
21
- if @input == "ALL"
22
- list_all_headlines_banner
23
- list_all_headlines
24
- all_headlines_open_in_browser
25
- elsif @input == "SOURCES"
26
- news_sources_banner
27
- news_sources
28
- puts request_input_full_menu
29
- print "YOUR SELECTION: "
30
- elsif source_includes?(@input)
31
- list_headlines_from_source
32
- headlines_from_source_open_in_browser
33
- elsif @input != "EXIT"
34
- invalid_entry
35
- else
36
- nil
37
- end
20
+ if @input == "ALL"
21
+ list_all_headlines_banner
22
+ list_all_headlines
23
+ all_headlines_open_in_browser
24
+ elsif @input == "SOURCES"
25
+ news_sources_banner
26
+ news_sources
27
+ puts request_input_full_menu
28
+ print "YOUR SELECTION: "
29
+ elsif source_includes?(@input)
30
+ list_headlines_from_source
31
+ headlines_from_source_open_in_browser
32
+ elsif @input != "EXIT"
33
+ invalid_entry
34
+ else
35
+ nil
36
+ end
38
37
  end
39
38
 
40
39
  def welcome_banner
@@ -160,7 +160,7 @@ class TopHeadlines::Source
160
160
 
161
161
  doc = Nokogiri::HTML(open(page_url))
162
162
 
163
- headlines = doc.css(headlines_selector).map {|headline| headline.text.gsub("â", "'").gsub(/\n/,"").gsub(/\t/,"").strip}
163
+ headlines = doc.css(headlines_selector).map {|headline| headline.text.strip.gsub("â", "'").gsub(/\n/,"").gsub(/\t/,"").gsub(/\d+$/,"")}
164
164
  end
165
165
 
166
166
  def self.scrape_urls(source)
@@ -1,3 +1,3 @@
1
1
  module TopHeadlines
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: top-headlines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Newburgh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler