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.6.2 lib/timber/context.rb
timber-2.6.1 lib/timber/context.rb
timber-2.6.0 lib/timber/context.rb
timber-2.6.0.pre.beta2 lib/timber/context.rb
timber-2.6.0.pre.beta1 lib/timber/context.rb
timber-2.5.1 lib/timber/context.rb
timber-2.5.0 lib/timber/context.rb
timber-2.4.0 lib/timber/context.rb
timber-2.3.4 lib/timber/context.rb
timber-2.3.3 lib/timber/context.rb
timber-2.3.2 lib/timber/context.rb
timber-2.3.1 lib/timber/context.rb
timber-2.3.0 lib/timber/context.rb
timber-2.2.3 lib/timber/context.rb
timber-2.2.2 lib/timber/context.rb
timber-2.2.1 lib/timber/context.rb
timber-2.2.0 lib/timber/context.rb
timber-2.1.10 lib/timber/context.rb
timber-2.1.9 lib/timber/context.rb
timber-2.1.8 lib/timber/context.rb