Sha256: 657d8e9a466c24395b00b1a782a3eea4f3bd45a9dbc4f050e17ec9b88b5de374

Contents?: true

Size: 685 Bytes

Versions: 3

Compression:

Stored size: 685 Bytes

Contents

# frozen_string_literal: true

Thread.attr_accessor :bridgetown_state

module Bridgetown
  class Current
    class << self
      def thread_state = Thread.current.bridgetown_state ||= {}

      # @return [Bridgetown::Site, nil]
      def site = sites[:main]

      def site=(new_site)
        sites[:main] = new_site
      end

      # @return [Hash<Symbol, Bridgetown::Site>]
      def sites
        thread_state[:sites] ||= {}
      end

      # @return [Bridgetown::Configuration]
      def preloaded_configuration = thread_state[:preloaded_configuration]

      def preloaded_configuration=(value)
        thread_state[:preloaded_configuration] = value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bridgetown-core-2.0.0.beta3 lib/bridgetown-core/current.rb
bridgetown-core-2.0.0.beta2 lib/bridgetown-core/current.rb
bridgetown-core-2.0.0.beta1 lib/bridgetown-core/current.rb