lib/meibo.rb in meibo-0.21.0 vs lib/meibo.rb in meibo-0.22.0

- old
+ new

@@ -14,14 +14,26 @@ ENUM_EXT_PATTERN = /\Aext:[a-zA-Z0-9.\-_]+\z/.freeze class << self attr_accessor :default_profile + def current_profile + thread_local_data[:current_profile] || default_profile + end + def current_roster thread_local_data[:roster] end + def with_profile(default_profile) + orig_default_profile = thread_local_data[:current_profile] + thread_local_data[:current_profile] = default_profile + yield + ensure + thread_local_data[:current_profile] = orig_default_profile + end + def with_roster(roster) orig_roster = thread_local_data[:roster] thread_local_data[:roster] = roster yield ensure @@ -36,6 +48,6 @@ end end loader.eager_load -Meibo.default_profile = Meibo::Profile.new +Meibo.default_profile = Meibo::Profiles["v1.2"]