You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
404 B
22 lines
404 B
2 years ago
|
# 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
|