secret_santa 0.0.2 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/secret_santa.rb +11 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a25f18576ec5f27b591edb9cefae2461d0ec9a2a
4
- data.tar.gz: c0cff936e01201c8acc1ec74ce3d59821a63c00f
3
+ metadata.gz: 34261cce4517c5828a4ba6fd0f3a8652eb496405
4
+ data.tar.gz: 5c452fb3870b1084cb1e2d6b37597a14557f57ac
5
5
  SHA512:
6
- metadata.gz: 40b621ecbc7a3b746baa28864026b4055616f580b282c9bdd4cebfd10329cad9cc3265e7ace7d8ce2fc47ad7cb9cdf7b79e288449f29ed9610598cb167c0ab9d
7
- data.tar.gz: d18e4293f181a0b5d8eadbeeb25c26d632198575f0dc767fff4c83dfaa5d1b278987fd0d0c14a5bf0463c40c7fb32a3179e0f32c77394aa8513024d86653236d
6
+ metadata.gz: b2e774d631215beb31d5abd20e9aa6c4e95a3903007901783ec6418494e2057590f0e7618ecdbd1dbb9463beb60faaeeb05fd07f8989b24cd9093cb941344812
7
+ data.tar.gz: 4358f9d5920ecfb6888500a57865aafae2f9fb19e8a5d6ba77cb1e3b8166382b97957124799b512402f410439d451b3f1b5ba68bf10c0e77b79a42d2e3196b48
data/lib/secret_santa.rb CHANGED
@@ -2,19 +2,22 @@ class SecretSanta
2
2
  # Create the Secret Santa list
3
3
  def self.create_list(names)
4
4
  if names.length <= 2
5
- "ERROR: List too short"
5
+ 'ERROR: List too short'
6
6
  elsif names.length != names.uniq.length
7
- "ERROR: Please enter unique names"
7
+ 'ERROR: Please enter unique names'
8
8
  else
9
9
  # Build the list
10
10
  list = []
11
- digraph_list = []
12
11
  names.shuffle!
13
- names.each_with_index { |name, i| list << "#{name} -> #{names[i - 1]}" }
12
+ names.each_with_index do |name, i|
13
+ list << "#{name} -> #{names[i - 1]}"
14
+ end
14
15
  # Write the list to a graphviz dot file
15
- digraph_list = list.join("; ")
16
+ digraph_list = list.join('; ')
16
17
  digraph = "digraph {#{digraph_list}}\n"
17
- File.open("#{Time.now.year}_secret_santa_list.dot", 'w') { |f| f.write("#{digraph}") }
18
+ File.open("#{Time.now.year}_secret_santa_list.dot", 'w') do |f|
19
+ f.write("#{digraph}")
20
+ end
18
21
  # Return the list
19
22
  puts "\n#{Time.now.year} Secret Santa List:"
20
23
  puts list
@@ -24,8 +27,8 @@ class SecretSanta
24
27
 
25
28
  # Get Secret Santa names and handle
26
29
  def self.solicit_input
27
- puts "Enter each name in the Secret Santa pool, separated by a space:"
30
+ puts 'Enter each name in the Secret Santa pool, separated by a space:'
28
31
  names = gets.downcase.chomp
29
- create_list(names.split(" "))
32
+ create_list(names.split(' '))
30
33
  end
31
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secret_santa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Worth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2014-12-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Secret Santa engine, written in Ruby
14
14
  email: jake@worth-chicago.co