module Aws::SiteMonitor::PstoreRecord
Public Class Methods
new(id: ::SecureRandom.hex(16), **_attributes)
click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 60 def initialize(id: ::SecureRandom.hex(16), **_attributes) self['id'] = id _attributes.each_pair do |k,v| self[k] = v end end
Public Instance Methods
[](k)
click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 52 def [](k) instance_variable_get(:"@#{k}") end
[]=(k,v)
click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 56 def []=(k,v) instance_variable_set(:"@#{k}", v) end
attributes()
click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 68 def attributes instance_variables.each_with_object({}) do |k, obj| key = k[1,k.length] obj[key] = self[key] end.symbolize_keys end
destroy()
click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 75 def destroy self.class.database.transaction do self.class.database.delete(self[:id]) end true end
save()
click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 84 def save records = self.class.database records.transaction do records[@id] = self.attributes.symbolize_keys records.commit end end