brendan-skynet 0.9.315 → 0.9.316

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,11 @@ module Skynet::ActiveRecordExtensions
3
3
  module ClassMethods
4
4
 
5
5
  def distributed_find(*args)
6
+ if args.last.is_a?(Hash)
7
+ options = args.pop.dup
8
+ options[:conditions] = sanitize_sql(options[:conditions]) if options[:conditions]
9
+ args << options
10
+ end
6
11
  all = ActiveRecord::Mapreduce.find(*args)
7
12
  all.model_class = self
8
13
  all
@@ -193,7 +198,7 @@ module ActiveRecord
193
198
  job.run
194
199
  end
195
200
 
196
- def map(klass_or_method=nil,&block)
201
+ def map(klass_or_method=nil, *arguments, &block)
197
202
  klass_or_method ||= model_class
198
203
  log = Skynet::Logger.get
199
204
 
@@ -208,7 +213,8 @@ module ActiveRecord
208
213
  if block_given?
209
214
  batch_item << block
210
215
  else
211
- batch_item << "#{klass_or_method}"
216
+ batch_item << "#{klass_or_method}"
217
+ batch_item << arguments
212
218
  end
213
219
  batches << batch_item
214
220
  if batches.size >= MAX_BATCHES_PER_JOB
@@ -267,7 +273,7 @@ module ActiveRecord
267
273
  if data[4].kind_of?(String)
268
274
  if ar_object.respond_to?(data[4].to_sym)
269
275
  # log.error "CALLING #{data[4]} on #{ar_object.class}:#{ar_object.id}"
270
- ar_object.send(data[4].to_sym)
276
+ ar_object.send(data[4].to_sym, *data[5])
271
277
  else
272
278
  begin
273
279
  data[4].constantize.each(ar_object)
@@ -2,7 +2,7 @@ class Skynet #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 9
5
- TINY = 315
5
+ TINY = 316
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{skynet}
3
- s.version = "0.9.315"
3
+ s.version = "0.9.316"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Adam Pisoni", "Brendan Baldwin"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brendan-skynet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.315
4
+ version: 0.9.316
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Pisoni