mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 10:32:08 +08:00
DEV: Refactor subclasses in ThemeSettingsManager
to individual files (#25605)
Why this change? One Ruby class per file improves readability
This commit is contained in:

committed by
GitHub

parent
7ce76143ac
commit
fb0e656cb7
19
lib/theme_settings_manager/string.rb
Normal file
19
lib/theme_settings_manager/string.rb
Normal file
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ThemeSettingsManager::String < ThemeSettingsManager
|
||||
def is_valid_value?(new_value)
|
||||
(@opts[:min]..@opts[:max]).include? new_value.to_s.length
|
||||
end
|
||||
|
||||
def textarea
|
||||
@opts[:textarea]
|
||||
end
|
||||
|
||||
def json_schema
|
||||
begin
|
||||
JSON.parse(@opts[:json_schema])
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user