Class: ThemeSettingsManager::String

Inherits:
ThemeSettingsManager show all
Defined in:
lib/theme_settings_manager.rb

Instance Attribute Summary

Attributes inherited from ThemeSettingsManager

#default, #name, #theme

Instance Method Summary collapse

Methods inherited from ThemeSettingsManager

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, #value=

Constructor Details

This class inherits a constructor from ThemeSettingsManager

Instance Method Details

#is_valid_value?(new_value) ⇒ Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/theme_settings_manager.rb', line 113

def is_valid_value?(new_value)
  (@opts[:min]..@opts[:max]).include? new_value.to_s.length
end

#json_schemaObject



121
122
123
124
125
126
127
# File 'lib/theme_settings_manager.rb', line 121

def json_schema
  begin
    JSON.parse(@opts[:json_schema])
  rescue StandardError
    false
  end
end

#textareaObject



117
118
119
# File 'lib/theme_settings_manager.rb', line 117

def textarea
  @opts[:textarea]
end