project_euler_cli 1.1.2 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6779626e07ad722584aa34beb3a2f3f2d0db6be50e19c77d8d1cbad050befb23
4
- data.tar.gz: 5247763643de597db2903e2973332e921d5dcb954d0af74d0f9fe104934439eb
3
+ metadata.gz: 44d8074a02474483217dd5fe84dbc2097e4c74eddefd9f1e5f15963bdccd8e56
4
+ data.tar.gz: 6bf1bb9012bf4513e88d3c5a879cc632e26ef965c5219729d0d5e7d7fedb739c
5
5
  SHA512:
6
- metadata.gz: 4d3dffe05c81249a33cf6a1eda98cd1df94d35da6280ae46e25068bcd22b0750705d4461486c0cc3df4b7fd37b405ef57185d902c72a3c0c1c6223d4b4e02e40
7
- data.tar.gz: e70681145d9f1dfefa4528404b3e8ddedbd66332963f13a5c2f81818af94651da308311b170504815fdca67aac88199781e9b13ee6aa8c652827caa33f4d1abd
6
+ metadata.gz: 20d4c42262c68b6ab3b2d8448fef4d6985fadb3462bcbb162e89735ba8363ade9142e4fcce4eb5dfce63e30d551de23939c3c39a65a47a9dbc39de13407f8bec
7
+ data.tar.gz: 1cc985f77f2406ce7a7a48d9e28030336eea05bc8d228882ac20418315b5fad8ee673983cf3deff16bfde45f3ddfd6f53cf6b92291f6fc36f82491e5773f7591
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- project_euler_cli (1.1.2)
4
+ project_euler_cli (1.1.3)
5
5
  nokogiri (~> 1.8)
6
6
 
7
7
  GEM
@@ -25,24 +25,18 @@ class ArchiveSearcher
25
25
  end
26
26
 
27
27
  # Performs a simple search of the problems. It accepts multiple terms. Results
28
- # will contain *any* of the terms
28
+ # will contain *all* of the search terms.
29
29
  #
30
30
  # * +terms+ - String of search terms
31
31
  def search(terms)
32
- if @initial_search
33
- @initial_search = false
34
- load_terms
35
- end
32
+ load_terms if Page.visited != (0..Page.total).to_a
36
33
 
37
34
  puts "searching..."
38
- @results.clear
39
35
  @searching = true
40
36
 
41
- terms.downcase.split(' ').each do |term|
42
- for i in 1..Problem.total
43
- if @problems[i].title.downcase.include?(term.downcase)
44
- @results << i
45
- end
37
+ @results = (1..Problem.total).select do |i|
38
+ terms.downcase.split(' ').all? do |term|
39
+ @problems[i].title.downcase.include?(term)
46
40
  end
47
41
  end
48
42
  end
@@ -26,9 +26,9 @@ class ArchiveViewer
26
26
 
27
27
  puts
28
28
 
29
- i = (page - 1) * Page::LENGTH
30
- Page::LENGTH.times do
31
- puts "#{i += 1} - #{@problems[i].title}" unless i >= Problem.total - 9
29
+ start = (page - 1) * Page::LENGTH + 1
30
+ start.upto(start + Page::LENGTH - 1) do |i|
31
+ puts "#{i} - #{@problems[i].title}" unless i >= Problem.total - 9
32
32
  end
33
33
  end
34
34
 
@@ -38,6 +38,8 @@ class ArchiveViewer
38
38
  def display_problem(id)
39
39
  load_problem_details(id, @problems)
40
40
 
41
+ puts
42
+ puts "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
41
43
  puts
42
44
  puts "#{@problems[id].title}".upcase
43
45
  puts "Problem #{id}"
@@ -47,6 +49,8 @@ class ArchiveViewer
47
49
  puts @problems[id].difficulty if id < Problem.total - 9
48
50
  puts
49
51
  puts "https://projecteuler.net/problem=#{id}"
52
+ puts
53
+ puts "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
50
54
  end
51
55
 
52
56
  # Displays a custom page of problems given by an array of IDs.
@@ -20,17 +20,17 @@ class CLI
20
20
 
21
21
  def banner
22
22
  puts
23
- puts " ---------------------------------- "
24
- puts " [ Project Euler ]"
25
- puts " [ e^iπ = -1 ]"
26
- puts " ---------------------------------- "
23
+ puts " ---------------------------------- "
24
+ puts " [ Project Euler ] "
25
+ puts " [ e^iπ = -1 ] "
26
+ puts " ---------------------------------- "
27
27
  end
28
28
 
29
29
  def main_menu
30
- puts " - List recent problems (r) -"
31
- puts " - List archived problems (l) -"
32
- puts " - Search (s) -"
33
- puts " - Exit (x) -"
30
+ puts " - List recent problems (r) - "
31
+ puts " - List archived problems (l) - "
32
+ puts " - Search (s) - "
33
+ puts " - Exit (x) - "
34
34
 
35
35
  input = prompt
36
36
 
@@ -1,5 +1,6 @@
1
1
  module ProjectEulerCli
2
2
 
3
+ # Holds all of the methods related to accessing the site.
3
4
  module Scraper
4
5
 
5
6
  # Pulls information from the recent page to determine the total number of
@@ -1,3 +1,3 @@
1
1
  module ProjectEulerCli
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: project_euler_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ecssiah
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-22 00:00:00.000000000 Z
11
+ date: 2018-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler