recurs 0.0.4.4 → 0.0.4.5

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. data/lib/recurs.rb +26 -3
  2. data/lib/recurs/version.rb +1 -1
  3. metadata +2 -2
@@ -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 InstanceMethods
214
- attr_accessor :repeats, :dtstart, :dtend
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
@@ -1,3 +1,3 @@
1
1
  module Recurs
2
- VERSION = "0.0.4.4"
2
+ VERSION = "0.0.4.5"
3
3
  end
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.0.4.4
9
+ - 5
10
+ version: 0.0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve Caney Martin