random_pizza 0.1.4 → 0.1.6

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: 78f4c6c1e1f870646e104f5cbd12a5f2d37d656d
4
- data.tar.gz: 6a5f987e42a65818f1198a75ba66008e3eeac897
3
+ metadata.gz: eb7b06965747b82e4b9075edece97047f7322422
4
+ data.tar.gz: 0780ad93541a97ea23112a425ec7a81729476097
5
5
  SHA512:
6
- metadata.gz: 9a33a6548b8e9f9c24b00581c77d359c7b8afbaa9392fde89cf81771db7940d1102fcc797b3c36563c293df2e7ff0db20529846ffdff00358e2aebb1ac430b68
7
- data.tar.gz: b6755947e0effe5f68a71cf8c70bae0bf6c60a32f65dbbaa7294b0077637ec1fed71222c6cb5d00c8d021657c012167d95e2c72f2fc76714ccf993eb86406f0c
6
+ metadata.gz: eb33d3c1ed3fc7e54ca1e98af22bd6f8fa3778582a79dacca6e66f83d6c417b4e958172fd3ec0a1d55a9868e023f8eca31b65fa15c1afeb04b3d87cd01f57a45
7
+ data.tar.gz: 80986e59de20605ca06753a173bcb60c52c55297d884cbb479a9d61b131fb269ee6ebae0b09692c149c1e85d69aac1e2dea10ff733f8a44c07c5e25b0c50c26c
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'random_pizza'
4
4
  p = RandomPizza.new
5
- puts p.suggestion
5
+ puts p.suggestion
data/lib/random_pizza.rb CHANGED
@@ -1,24 +1,33 @@
1
+ ##
2
+ # This class suggests a random pizza to adventurous impatient hungry people
3
+
1
4
  class RandomPizza
2
- attr_accessor :suggestion
3
5
 
4
- def initialize
5
- #puts s
6
- end
7
-
8
6
  def suggestion
9
- "You should try #{crust} crust with #{sauce} and #{toppings}."
7
+ "You should try #{crust} crust with #{sauce} sauce and #{toppings}."
10
8
  end
11
9
 
10
+ private
11
+
12
12
  def crust
13
13
  ["whole wheat", "thin", "gluten-free", "classic"].sample
14
14
  end
15
15
 
16
16
  def sauce
17
- ["tomato sauce", "garlic and olive oil", "pesto", "vegan bechamel"].sample
17
+ ["tomato", "garlic and olive oil", "pesto", "vegan bechamel"].sample
18
+ end
19
+
20
+ def toppings n=3
21
+ toppings = ["garlic", "onions", "tomatoes", "olives", "green peppers", "potatoes", "spinach",
22
+ "artichoke hearts", "roasted red peppers", "jalapenos", "pineapple", "roasted garlic",
23
+ "sun-dried tomatoes", "tempeh bacon", "roasted beets"]
24
+ return join_with_comma toppings.sample(n)
18
25
  end
19
26
 
20
- def toppings
21
- ["garlic", "onions", "tomatoes", "olives", "green peppers", "potatoes", "spinach"].sample
27
+ def join_with_comma(items)
28
+ items[-1] = "and #{items[-1]}"
29
+ return items.join(", ") if items.count > 2
30
+ return items.join(" ") if items.count <= 2
22
31
  end
23
32
 
24
- end
33
+ end
metadata CHANGED
@@ -1,24 +1,24 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: random_pizza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynne Cooney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-20 00:00:00.000000000 Z
11
+ date: 2014-03-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Generate a random pizza suggestion
14
14
  email: ilynne@gmail.com
15
15
  executables:
16
- - pizza
16
+ - random_pizza
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/random_pizza.rb
21
- - bin/pizza
21
+ - bin/random_pizza
22
22
  homepage: http://rubygems.org/gems/random_pizza
23
23
  licenses:
24
24
  - MIT