Sha256: ab4b358ad6750db7c5f6ea3081b03e865e92902a5a8214a86b322466dc5bade0

Contents?: true

Size: 844 Bytes

Versions: 34

Compression:

Stored size: 844 Bytes

Contents

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

    # 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 keyspace
      self.class.keyspace
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
timber-2.1.7 lib/timber/context.rb
timber-2.1.6 lib/timber/context.rb
timber-2.1.5 lib/timber/context.rb
timber-2.1.4 lib/timber/context.rb
timber-2.1.3 lib/timber/context.rb
timber-2.1.2 lib/timber/context.rb
timber-2.1.1 lib/timber/context.rb
timber-2.1.0 lib/timber/context.rb
timber-2.1.0.rc6 lib/timber/context.rb
timber-2.1.0.rc5 lib/timber/context.rb
timber-2.1.0.rc4 lib/timber/context.rb
timber-2.1.0.rc3 lib/timber/context.rb
timber-2.1.0.rc2 lib/timber/context.rb
timber-2.1.0.rc1 lib/timber/context.rb