It could also be done like this, that would notably avoid reading the ivar twice and make it clearer it’s eager-initialized (the logic could also be in a initial_flag_settings helper method for organization of course):
class << self
attr_reader :flag_settings
end
@flag_settings = FlagSettings.new
@flag_settings.add(
3,
:off_topic,
notify_type: true,
auto_action_type: true,
)
# ...