Module: SuperSettings::Storage

Included in:
ActiveRecordStorage, HttpStorage, MongoDBStorage, NullStorage, StorageAttributes, TestStorage
Defined in:
lib/super_settings/storage.rb,
lib/super_settings/storage/s3_storage.rb,
lib/super_settings/storage/transaction.rb,
lib/super_settings/storage/http_storage.rb,
lib/super_settings/storage/json_storage.rb,
lib/super_settings/storage/null_storage.rb,
lib/super_settings/storage/test_storage.rb,
lib/super_settings/storage/redis_storage.rb,
lib/super_settings/storage/mongodb_storage.rb,
lib/super_settings/storage/history_attributes.rb,
lib/super_settings/storage/storage_attributes.rb,
lib/super_settings/storage/active_record_storage.rb,
lib/super_settings/storage/active_record_storage/models.rb

Overview

Abstraction over how a setting is stored and retrieved from the storage engine. Models must implement the methods module in this module that raise NotImplementedError.

Defined Under Namespace

Modules: ClassMethods, Transaction Classes: ActiveRecordStorage, HistoryAttributes, HttpStorage, JSONStorage, MongoDBStorage, NullStorage, RedisStorage, S3Storage, StorageAttributes, TestStorage

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



18
19
20
21
22
23
# File 'lib/super_settings/storage.rb', line 18

def self.included(base)
  base.extend(ClassMethods)
  base.include(Attributes) unless base.instance_methods.include?(:attributes=)

  base.instance_variable_set(:@load_asynchronous, nil)
end

Instance Method Details

#==(other) ⇒ Object



286
287
288
# File 'lib/super_settings/storage.rb', line 286

def ==(other)
  other.is_a?(self.class) && other.key == key
end

#create_history(changed_by:, created_at:, value: nil, deleted: false) ⇒ void

This method returns an undefined value.

Create a history item for the setting.



265
266
267
# File 'lib/super_settings/storage.rb', line 265

def create_history(changed_by:, created_at:, value: nil, deleted: false)
  self.class.create_history(key: key, changed_by: changed_by, created_at: created_at, value: value, deleted: deleted)
end

#created_atTime

Return the time the setting was created.

Raises:

  • (NotImplementedError)


236
237
238
239
240
# File 'lib/super_settings/storage.rb', line 236

def created_at
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#created_at=(val) ⇒ void

This method returns an undefined value.

Set the created time for the setting.

Raises:

  • (NotImplementedError)


246
247
248
249
250
# File 'lib/super_settings/storage.rb', line 246

def created_at=(val)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#deleted=(val) ⇒ void

This method returns an undefined value.

Set the deleted flag for the setting. Settings should not actually be deleted since the record is needed to keep the local cache up to date.

Raises:

  • (NotImplementedError)


208
209
210
211
212
# File 'lib/super_settings/storage.rb', line 208

def deleted=(val)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#deleted?Boolean

Return true if the setting marked as deleted.

Raises:

  • (NotImplementedError)


197
198
199
200
201
# File 'lib/super_settings/storage.rb', line 197

def deleted?
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#descriptionString

The description for the setting.

Raises:

  • (NotImplementedError)


178
179
180
181
182
# File 'lib/super_settings/storage.rb', line 178

def description
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#description=(val) ⇒ void

This method returns an undefined value.

Set the description for the setting.

Raises:

  • (NotImplementedError)


188
189
190
191
192
# File 'lib/super_settings/storage.rb', line 188

def description=(val)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#history(limit: nil, offset: 0) ⇒ Array<SuperSettings::History>

Return array of history items reflecting changes made to the setting over time. Items should be returned in reverse chronological order so that the most recent changes are first.

Raises:

  • (NotImplementedError)


256
257
258
259
260
# File 'lib/super_settings/storage.rb', line 256

def history(limit: nil, offset: 0)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#keyString

The key for the setting

Raises:

  • (NotImplementedError)


121
122
123
124
125
# File 'lib/super_settings/storage.rb', line 121

def key
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#key=(val) ⇒ void

This method returns an undefined value.

Set the key for the setting.

Raises:

  • (NotImplementedError)


131
132
133
134
135
# File 'lib/super_settings/storage.rb', line 131

def key=(val)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#persisted?Boolean

Return true if the record has been stored.

Raises:

  • (NotImplementedError)


280
281
282
283
284
# File 'lib/super_settings/storage.rb', line 280

def persisted?
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#raw_valueString

The raw value for the setting before it is type cast.

Raises:

  • (NotImplementedError)


140
141
142
143
144
# File 'lib/super_settings/storage.rb', line 140

def raw_value
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#raw_value=(val) ⇒ void

This method returns an undefined value.

Set the raw value for the setting.

Raises:

  • (NotImplementedError)


150
151
152
153
154
# File 'lib/super_settings/storage.rb', line 150

def raw_value=(val)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#save!void

This method returns an undefined value.

Persist the record to storage.

Raises:

  • (NotImplementedError)


272
273
274
275
276
# File 'lib/super_settings/storage.rb', line 272

def save!
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#updated_atTime

Return the time the setting was last updated

Raises:

  • (NotImplementedError)


217
218
219
220
221
# File 'lib/super_settings/storage.rb', line 217

def updated_at
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#updated_at=(val) ⇒ void

This method returns an undefined value.

Set the last updated time for the setting.

Raises:

  • (NotImplementedError)


227
228
229
230
231
# File 'lib/super_settings/storage.rb', line 227

def updated_at=(val)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#value_typeString

The value type for the setting.

Raises:

  • (NotImplementedError)


159
160
161
162
163
# File 'lib/super_settings/storage.rb', line 159

def value_type
  # :nocov:
  raise NotImplementedError
  # :nocov:
end

#value_type=(val) ⇒ void

This method returns an undefined value.

Set the value type for the setting.

Raises:

  • (NotImplementedError)


169
170
171
172
173
# File 'lib/super_settings/storage.rb', line 169

def value_type=(val)
  # :nocov:
  raise NotImplementedError
  # :nocov:
end