Class: Oplogjam::Noop
- Inherits:
-
Object
- Object
- Oplogjam::Noop
- Defined in:
- lib/oplogjam/noop.rb
Instance Attribute Summary collapse
-
#h ⇒ Object
(also: #id)
readonly
Returns the value of attribute h.
-
#msg ⇒ Object
(also: #message)
readonly
Returns the value of attribute msg.
-
#ts ⇒ Object
readonly
Returns the value of attribute ts.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #apply(_mapping) ⇒ Object
-
#initialize(h, ts, msg) ⇒ Noop
constructor
A new instance of Noop.
- #timestamp ⇒ Object
Constructor Details
Instance Attribute Details
#h ⇒ Object (readonly) Also known as: id
Returns the value of attribute h.
5 6 7 |
# File 'lib/oplogjam/noop.rb', line 5 def h @h end |
#msg ⇒ Object (readonly) Also known as: message
Returns the value of attribute msg.
5 6 7 |
# File 'lib/oplogjam/noop.rb', line 5 def msg @msg end |
#ts ⇒ Object (readonly)
Returns the value of attribute ts.
5 6 7 |
# File 'lib/oplogjam/noop.rb', line 5 def ts @ts end |
Class Method Details
.from(bson) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/oplogjam/noop.rb', line 7 def self.from(bson) h = bson.fetch(H) ts = bson.fetch(TS) o = bson.fetch(O) msg = o.fetch(MSG) new(h, ts, msg) rescue KeyError => e raise InvalidNoop, "missing field: #{e}" end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 34 35 |
# File 'lib/oplogjam/noop.rb', line 31 def ==(other) return false unless other.is_a?(Noop) id == other.id end |
#apply(_mapping) ⇒ Object
37 |
# File 'lib/oplogjam/noop.rb', line 37 def apply(_mapping); end |
#timestamp ⇒ Object
27 28 29 |
# File 'lib/oplogjam/noop.rb', line 27 def Time.at(ts.seconds, ts.increment) end |