Sha256: 03c33241ddc5f15360b2ed70cec5a2c394aa2c9046fee1c135fe3fde6921e52e

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

require "zeitwerk"
loader = Zeitwerk::Loader.for_gem
loader.ignore("#{__dir__}/meibo/errors.rb")
loader.ignore("#{__dir__}/meibo/factory_bot")
loader.setup

require_relative "meibo/version"
require_relative "meibo/errors"

module Meibo
  CSV_ENCODING = 'UTF-8'
  ENUM_EXT_PATTERN = /\Aext:[a-zA-Z0-9\.\-_]+\z/

  class << self
    attr_accessor :default_profile

    def current_roster
      thread_local_data[:roster]
    end

    def with_roster(roster)
      orig_roster = thread_local_data[:roster]
      thread_local_data[:roster] = roster
      yield
    ensure
      thread_local_data[:roster] = orig_roster
    end

    private

    def thread_local_data
      Thread.current[:__meibo] ||= {}
    end
  end
end

loader.eager_load

Meibo.default_profile = Meibo::Profile.new

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
meibo-0.16.0 lib/meibo.rb
meibo-0.15.0 lib/meibo.rb
meibo-0.14.0 lib/meibo.rb
meibo-0.13.0 lib/meibo.rb