top-recipes 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 6f0b8f39323ee924f4274ccf9162a32764bb134f
4
- data.tar.gz: 7c7581af55c3861f544a5b2c07f6e16038d2bef0
3
+ metadata.gz: 7eca309c16596908bf90382548dbdf8084b655c0
4
+ data.tar.gz: d6d928b41fa5bec42ee722406e987e6e54883d90
5
5
  SHA512:
6
- metadata.gz: 2bec8aab8b682f66b90b17e64758a310f809f38d4f71573e1c04ff2e01b01f083af257e6923d61b7f1927dea0dd2f3d6efbc30370b0c383151adee3684c6c2fa
7
- data.tar.gz: 9b512a942d355a58821982bd6d0ab48444c144a1a1bfef87cdc86c9496be9e7f460de6768dc9b16fec28c5c078a614cf5b7ce5d0c333d63efe8df325cb0e435f
6
+ metadata.gz: 704004e4649d52e414eda750d79cc2e1a3e67f5066fe8ddc49617e8d02f7542ae73146a8194c5e627592cf159ef5e46de183ee021560a7e67dc3fead2cbb5cf6
7
+ data.tar.gz: 40ca6d49ee29f6cf6218e832b990e29d9694c14f202761563ef07a2164186fe96089a16970550de827a3a06726d707fbbe307c7664c830cf2155e81f63f9c318
@@ -43,7 +43,7 @@ class TopRecipes::CLI
43
43
 
44
44
  @input = gets.strip.downcase
45
45
 
46
- if @input.to_i > 0
46
+ if @input.to_i > 0 && @input.to_i <= TopRecipes::Recipe.top_recipes.size
47
47
  self.list_details
48
48
  else
49
49
  self.possible_commands
@@ -59,15 +59,15 @@ class TopRecipes::CLI
59
59
  puts "Recipe by #{recipe.author}, rating is #{recipe.rating}"
60
60
  self.line_break
61
61
  puts "---------- Ingredients: ----------"
62
- self.list_ingredients(recipe)
62
+ recipe.list_ingredients
63
63
  self.line_break
64
64
  puts "Directions are at the #{recipe.author}'s site:"
65
- puts "#{recipe.directions}. Type 'open' to open the link, or any of our other helpful commands: #{self.commands_available}"
65
+ puts "#{recipe.directions}. Type 'open' to open the link of directions, or any of our other helpful commands: #{self.commands_available}"
66
66
 
67
67
  @input = gets.strip
68
68
 
69
69
  if @input.downcase.strip == "open"
70
- system("open #{recipe.directions}")
70
+ recipe.open_directions_url
71
71
  self.again_or_close
72
72
  else
73
73
  self.possible_commands
@@ -85,20 +85,13 @@ class TopRecipes::CLI
85
85
  "'list recipes', 'joke', or 'exit'"
86
86
  end
87
87
 
88
- def self.list_ingredients(recipe)
89
- recipe.ingredients.each.with_index(1) {|i, k| puts "#{k}. #{i}"}
90
- end
91
-
92
-
93
88
  def self.possible_commands
94
- case @input.downcase.strip
95
- when "list recipes"
89
+ i = @input.downcase.strip
90
+ if ["list", "recipes", "recipe", "list recipes", "list recipe", "top recipes"].include? i
96
91
  self.list_recipes
97
- when "joke"
92
+ elsif ["joke", "jokes", "tell me a joke"].include? i
98
93
  self.joke
99
- when "exit"
100
- self.exit_program
101
- when "bye"
94
+ elsif ["exit", "bye", "exit!"].include? i
102
95
  self.exit_program
103
96
  else
104
97
  self.no_match
@@ -14,4 +14,12 @@ class TopRecipes::Recipe
14
14
  @@all
15
15
  end
16
16
 
17
+ def open_directions_url
18
+ system("open #{self.directions}")
19
+ end
20
+
21
+ def list_ingredients
22
+ self.ingredients.each.with_index(1) {|i, k| puts "#{k}. #{i}"}
23
+ end
24
+
17
25
  end
@@ -1,3 +1,3 @@
1
1
  module TopRecipes
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: top-recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - mxdavis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-21 00:00:00.000000000 Z
11
+ date: 2017-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler