rrschedule 0.1.0 → 0.1.1

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.
data/README.rdoc CHANGED
@@ -1,19 +1,19 @@
1
1
  = rrschedule
2
2
 
3
- RRSchedule make it easier to generate Round-Robin sport seasons. To generate a schedule, it needs a team list, a season
3
+ rrschedule makes it easier to generate Round-Robin schedules for sport leagues. To generate a schedule, it needs a team list, a season
4
4
  start date, the day(s) of the week where the games are played and some other options.
5
5
 
6
6
  It takes into consideration physical constraints such as the number of playing surfaces availables and game times.
7
- Each round of the round-robin is splitted into groups that respect these constraints.
7
+ Each round of the round-robin is splitted into multiple gamedays that respect these constraints.
8
8
 
9
9
  Say for example that you want to generate a round-robin schedule for your 15-teams volleyball league.
10
10
  If there are only 3 volleyball fields available and that games are played each monday at 6PM and 8PM, this is technically
11
- impossible to complete one round in a single day (only 6 games can be played). RRSchedule will put the rest of the games
12
- for this round on the next gameday and will start a new round right after.
11
+ impossible to complete one round in a single day. rrschedule will put the remaining games of this round on the next gameday
12
+ and will start a new round right after.
13
13
 
14
14
 
15
15
  == Installation
16
- gem install rrschedule (not on gemcutter yet... hold on)
16
+ gem install rrschedule
17
17
  require 'rrschedule.rb'
18
18
 
19
19
  == Prepare the schedule
@@ -85,7 +85,7 @@ for this round on the next gameday and will start a new round right after.
85
85
  puts g.game_date.to_s + " on playing surface " + g.playing_surface.to_s + " at " + g.game_time.to_s
86
86
  end
87
87
 
88
- === Iterate the schedule
88
+ === Iterate through schedule
89
89
  schedule.gamedays.each do |gd,games|
90
90
  puts gd
91
91
  puts "===================="
@@ -94,7 +94,10 @@ for this round on the next gameday and will start a new round right after.
94
94
  end
95
95
  puts "\n"
96
96
  end
97
+
98
+ == Other
97
99
 
98
- == Copyright
100
+ Hope this gem will be useful to some people!
101
+ As you can see, there are no tests yet but they should come quite soon.
99
102
 
100
- Copyright (c) 2010 flamontagne. See LICENSE for details.
103
+ You can read my blog here: www.rubyfleebie.com
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/rrschedule.rb CHANGED
@@ -10,7 +10,14 @@ module RRSchedule
10
10
  attr_reader :teams, :rounds
11
11
 
12
12
  def initialize(params={})
13
- store_params(params)
13
+ self.teams = params[:teams] || [1,2,3,4,5]
14
+ self.playing_surfaces = params[:playing_surfaces] || ["--"]
15
+ self.cycles = params[:cycles] || 1
16
+ self.game_times = params[:game_times] || ["7:00 PM"]
17
+ self.shuffle_initial_order = params[:shuffle_initial_order] || true
18
+ self.exclude_dates = params[:exclude_dates] || []
19
+ self.start_date = params[:start_date] || Time.now.beginning_of_day
20
+ self.wdays = Array(params[:wdays]).empty? ? [1] : Array(params[:wdays])
14
21
  end
15
22
 
16
23
 
@@ -137,19 +144,6 @@ module RRSchedule
137
144
  def games_per_day
138
145
  self.playing_surfaces.size * self.game_times.size
139
146
  end
140
-
141
- def store_params(params)
142
- self.teams = params[:teams] if params[:teams].respond_to?(:to_ary)
143
- self.playing_surfaces = params[:playing_surfaces] if params[:playing_surfaces].respond_to?(:to_ary)
144
- self.cycles = params[:cycles] if params[:cycles].respond_to?(:to_int)
145
- self.game_times = params[:game_times] if params[:game_times].respond_to?(:to_ary)
146
- self.shuffle_initial_order = params[:shuffle_initial_order]
147
- self.exclude_dates = params[:exclude_dates] || []
148
- self.start_date = params[:start_date] || Time.now.beginning_of_day
149
- self.wdays = Array(params[:wdays]) if params[:wdays].respond_to?(:to_ary) || params[:wdays].respond_to?(:to_int)
150
- end
151
-
152
-
153
147
  end
154
148
 
155
149
  class Game
data/rrschedule.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rrschedule}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["flamontagne"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrschedule
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - flamontagne