lib/agent/push.rb in agent-0.9.1 vs lib/agent/push.rb in agent-0.10.0

- old
+ new

@@ -1,12 +1,38 @@ require "agent/errors" module Agent class Push + SKIP_MARSHAL_TYPES = [ + ::Symbol, + ::Numeric, + ::NilClass, + ::TrueClass, + ::FalseClass, + ::Queue, + ::SizedQueue, + ::Thread, + ::Mutex, + ::Monitor, + ::Module, + ::IO, + ::Proc, + ::Method + ] + attr_reader :object, :uuid, :blocking_once, :notifier def initialize(object, options={}) - @object = Marshal.dump(object) + @object = case object + when *SKIP_MARSHAL_TYPES + object + else + if options[:skip_marshal] + object + else + Marshal.load(Marshal.dump(object)) + end + end @uuid = options[:uuid] || UUID.generate @blocking_once = options[:blocking_once] @notifier = options[:notifier] @mutex = Mutex.new @cvar = ConditionVariable.new