mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 21:33:40 +08:00
fb0e656cb7
Why this change? One Ruby class per file improves readability
20 lines
348 B
Ruby
20 lines
348 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ThemeSettingsManager::Integer < ThemeSettingsManager
|
|
def self.cast(value)
|
|
value.to_i
|
|
end
|
|
|
|
def value
|
|
self.class.cast(super)
|
|
end
|
|
|
|
def value=(new_value)
|
|
super(self.class.cast(new_value))
|
|
end
|
|
|
|
def is_valid_value?(new_value)
|
|
(@opts[:min]..@opts[:max]).include? new_value.to_i
|
|
end
|
|
end
|