Sha256: 0510c96fe0ab2b22717779330dddca1117b989f0a7eacc7e0b1aa05bb27cc4b9

Contents?: true

Size: 819 Bytes

Versions: 5

Compression:

Stored size: 819 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/.freeze

  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

5 entries across 5 versions & 1 rubygems

Version Path
meibo-0.21.0 lib/meibo.rb
meibo-0.20.0 lib/meibo.rb
meibo-0.19.0 lib/meibo.rb
meibo-0.18.0 lib/meibo.rb
meibo-0.17.0 lib/meibo.rb