recurs 0.0.4.4 → 0.0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/recurs.rb +26 -3
- data/lib/recurs/version.rb +1 -1
- metadata +2 -2
data/lib/recurs.rb
CHANGED
@@ -195,6 +195,15 @@ module Recurs
|
|
195
195
|
module ModelMethods
|
196
196
|
def acts_as_recurring
|
197
197
|
send :include, InstanceMethods
|
198
|
+
if defined? ActiveRecord::Base
|
199
|
+
if self.ancestors.include? ActiveRecord::Base
|
200
|
+
send :include, ARBased
|
201
|
+
else
|
202
|
+
send :include, NonARBased
|
203
|
+
end
|
204
|
+
else
|
205
|
+
send :include, NonARBased
|
206
|
+
end
|
198
207
|
send :extend, ModelClassMethods
|
199
208
|
end
|
200
209
|
|
@@ -210,15 +219,29 @@ module Recurs
|
|
210
219
|
end
|
211
220
|
end
|
212
221
|
|
213
|
-
module
|
214
|
-
|
215
|
-
def initialize
|
222
|
+
module NonARBased
|
223
|
+
def initialize(args ={})
|
216
224
|
@rrules ||= []
|
217
225
|
@exrules ||= []
|
218
226
|
@rdates ||= []
|
219
227
|
@exdates ||= []
|
220
228
|
super
|
221
229
|
end
|
230
|
+
end
|
231
|
+
|
232
|
+
module ARBased
|
233
|
+
def after_initialize(args ={})
|
234
|
+
@rrules ||= []
|
235
|
+
@exrules ||= []
|
236
|
+
@rdates ||= []
|
237
|
+
@exdates ||= []
|
238
|
+
super
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
module InstanceMethods
|
243
|
+
attr_accessor :repeats, :dtstart, :dtend
|
244
|
+
#after_initialize :set_attrs
|
222
245
|
|
223
246
|
def recurs
|
224
247
|
r = @rrules
|
data/lib/recurs/version.rb
CHANGED