simple_job 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = Simple Job
2
2
 
3
+ == Version 0.4.0
4
+ * Made JobDefinition#job_definition_class_for more resilient to input types
5
+ * Added #class_for alias to JobDefinition#job_definition_class_for
6
+
3
7
  == Version 0.3.0
4
8
  * Allowing JobDefinition#execute method to take a message parameter
5
9
  * Adding max_attempt_count declaration to JobDefinition
@@ -20,6 +20,28 @@ module JobDefinition
20
20
 
21
21
  end
22
22
 
23
+ class << self
24
+
25
+ def job_definition_class_for(type, version)
26
+ type = type.to_s.underscore.to_sym
27
+ version = version.to_s
28
+
29
+ @job_definitions.each do |definition|
30
+ if (definition[:type] == type) && (definition[:versions].include?(version))
31
+ return definition[:class]
32
+ end
33
+ end
34
+ nil
35
+ end
36
+
37
+ alias :class_for :job_definition_class_for
38
+
39
+ def job_definitions
40
+ @job_definitions ||= []
41
+ end
42
+
43
+ end
44
+
23
45
  # should be overridden by including classes
24
46
  if !method_defined?(:execute)
25
47
  def execute
@@ -105,19 +127,6 @@ module JobDefinition
105
127
  end
106
128
  end
107
129
 
108
- def self.job_definition_class_for(type, version)
109
- @job_definitions.each do |definition|
110
- if (definition[:type] == type.to_sym) && (definition[:versions].include?(version))
111
- return definition[:class]
112
- end
113
- end
114
- nil
115
- end
116
-
117
- def self.job_definitions
118
- @job_definitions ||= []
119
- end
120
-
121
130
  private
122
131
 
123
132
  module ClassMethods
@@ -1,3 +1,3 @@
1
1
  module SimpleJob
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_job
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Dawson