discourse/lib/theme_settings_manager/bool.rb
Alan Guo Xiang Tan fb0e656cb7
DEV: Refactor subclasses in ThemeSettingsManager to individual files (#25605)
Why this change?

One Ruby class per file improves readability
2024-02-08 12:59:52 +08:00

17 lines
303 B
Ruby

# frozen_string_literal: true
class ThemeSettingsManager::Bool < ThemeSettingsManager
def self.cast(value)
[true, "true"].include?(value)
end
def value
self.class.cast(super)
end
def value=(new_value)
new_value = (self.class.cast(new_value)).to_s
super(new_value)
end
end