lib/timber/context.rb in timber-2.0.24 vs lib/timber/context.rb in timber-2.1.0.rc1

- old
+ new

@@ -1,27 +1,30 @@ module Timber # Base class for all `Timber::Contexts::*` classes. # @private class Context class << self + # The keyspace is the key used when storing the context. + # For example: + # + # {:build => {:version => "1.0.0"}} + # + # The keyspace in the above context is `:build`. This is required + # because it prevents key name conflicts. Without the keyspace + # it very possible another context type might also have a `:version` + # attribute. def keyspace @keyspace || raise(NotImplementedError.new) end end - def keyspace - self.class.keyspace - end - + # Returns a simple structure sufficient for encoding. We use + # `as_json` as the name since this is a ruby pattern. def as_json(options = {}) raise NotImplementedError.new end - def to_json(options = {}) - as_json.to_json(options) - end - - def to_msgpack(*args) - as_json.to_msgpack(*args) + def keyspace + self.class.keyspace end end end \ No newline at end of file