gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app/models/user_settings/namespace.rb

22 lines
404 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class UserSettings::Namespace
attr_reader :name, :definitions
def initialize(name)
@name = name.to_sym
@definitions = {}
end
def configure(&block)
instance_eval(&block)
self
end
def setting(key, options = {})
UserSettings::Setting.new(key, options.merge(namespace: name)).tap do |s|
@definitions[s.key] = s
end
end
end