Class: ThemeSettingsManager::Enum
Instance Attribute Summary
#default, #name, #theme
Instance Method Summary
collapse
create, #create_record!, #db_record, #description, #ensure_is_valid_value!, #has_max?, #has_min?, #has_record?, #initialize, #invalid_value_error_message, #requests_refresh?, #type, #type_name, types, #value=
Instance Method Details
#choices ⇒ Object
180
181
182
|
# File 'lib/theme_settings_manager.rb', line 180
def choices
@opts[:choices]
end
|
#is_valid_value?(new_value) ⇒ Boolean
176
177
178
|
# File 'lib/theme_settings_manager.rb', line 176
def is_valid_value?(new_value)
choices.include?(new_value) || choices.map(&:to_s).include?(new_value)
end
|
#value ⇒ Object
170
171
172
173
174
|
# File 'lib/theme_settings_manager.rb', line 170
def value
val = super
match = choices.find { |choice| choice == val || choice.to_s == val }
match || val
end
|