Class: SuperSettings::Storage::MongoDBStorage::HistoryStorage
Instance Attribute Summary
#changed_by, #created_at, #deleted, #key, #value
Class Method Summary
collapse
Instance Method Summary
collapse
#deleted?, #initialize
Methods included from Attributes
#attributes=, #initialize
Class Method Details
.create!(attributes) ⇒ Object
30
31
32
33
34
|
# File 'lib/super_settings/storage/mongodb_storage.rb', line 30
def create!(attributes)
record = new(attributes)
record.save!
record
end
|
Instance Method Details
#as_bson ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/super_settings/storage/mongodb_storage.rb', line 49
def as_bson
attributes = {
value: value,
changed_by: changed_by,
created_at: created_at
}
attributes[:deleted] = true if deleted?
attributes
end
|
#created_at=(value) ⇒ Object
37
38
39
|
# File 'lib/super_settings/storage/mongodb_storage.rb', line 37
def created_at=(value)
super(TimePrecision.new(value, :millisecond).time)
end
|
#save! ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/super_settings/storage/mongodb_storage.rb', line 41
def save!
raise ArgumentError.new("Missing key") if Coerce.blank?(key)
MongoDBStorage.transaction do |changes|
changes << self
end
end
|