mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 22:19:32 +00:00
a9b5598c97
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
22 lines
404 B
Ruby
22 lines
404 B
Ruby
# 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
|