Class: Oplogjam::Operation
- Inherits:
-
Object
- Object
- Oplogjam::Operation
- Defined in:
- lib/oplogjam/operation.rb
Class Method Summary collapse
Class Method Details
.from(bson) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/oplogjam/operation.rb', line 12 def self.from(bson) op = bson.fetch(OP, UNKNOWN) case op when N then Noop.from(bson) when I then Insert.from(bson) when U then Update.from(bson) when D then Delete.from(bson) when C if bson.fetch(O, {}).key?(APPLY_OPS) ApplyOps.from(bson) else Command.from(bson) end else raise InvalidOperation, "invalid operation: #{bson}" end end |