jlindley-rlottery 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 3
2
+ :patch: 4
3
3
  :major: 0
4
4
  :minor: 1
@@ -0,0 +1,7 @@
1
+
2
+ To generate a skeleton custom rule file, run
3
+
4
+ ./script/generate rule_set FancyLottery
5
+
6
+ It will be placed in lib/rlottery/fancy_lottery_rule_set.rb
7
+
@@ -0,0 +1,8 @@
1
+ class RuleSetGenerator < Rails::Generator::NamedBase
2
+ def manifest
3
+ record do |m|
4
+ m.directory "lib/rlottery/rule_set"
5
+ m.template 'rule_set_template.erb', File.join('lib/rlottery/rule_set', "#{file_name}_rule_set.rb")
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ class Rlottery::RuleSet::<%= class_name %>RuleSet < Rlottery::RuleSet::BaseRuleSet
2
+
3
+ # Called automatically after initialization
4
+ # can be called manually in #run! also
5
+ def order_participants
6
+ # @participants = @participants.sort_by{rand}
7
+ end
8
+
9
+ # Called automatically after initialization
10
+ # can be called manually in #run! also
11
+ def order_slots
12
+ # @slots = @slots.sort_by{rand}
13
+ end
14
+
15
+ def run!
16
+ # the algorithm for combining participants and slots
17
+ raise NotImplementedError, "RuleSet not written yet!"
18
+
19
+ # should call #assign_pair to mutually match up entities
20
+ assign_pair(@some_slot, @some_participant)
21
+ end
22
+
23
+ end
@@ -33,7 +33,7 @@ module Rlottery
33
33
  unless self.respond_to?(meth) # # just do this once per class..
34
34
  self.class.instance_eval do # class SomeEntity
35
35
  define_method meth do # def foo
36
- instance_variable_get ivar_name # instance_variable_get @foo
36
+ instance_variable_get ivar_name # instance_variable_get '@foo'
37
37
  end # end
38
38
  end # end
39
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jlindley-rlottery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Lindley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-01 00:00:00 -08:00
12
+ date: 2009-03-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -23,6 +23,11 @@ extra_rdoc_files: []
23
23
 
24
24
  files:
25
25
  - VERSION.yml
26
+ - generators/rule_set
27
+ - generators/rule_set/rule_set_generator.rb
28
+ - generators/rule_set/templates
29
+ - generators/rule_set/templates/rule_set_template.erb
30
+ - generators/rule_set/USAGE
26
31
  - lib/rlottery
27
32
  - lib/rlottery/entity.rb
28
33
  - lib/rlottery/lottery.rb