module Aws::SiteMonitor::PstoreRecord::ClassMethods

Public Instance Methods

[](k) click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 15
def [](k)
  instance_variable_get(:"@_#{k}")
end
all() click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 36
def all
  database.transaction(true) do  # begin read-only transaction
    database.roots.map do |data_root_name|
      # binding.pry
      record = database[data_root_name]
      record.symbolize_keys!
      new(**record.symbolize_keys)
    end
  end
end
create(attributes={}) click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 31
def create(attributes={})
  record = new(attributes)
  record.save
end
database() click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 27
def database
  @_database ||= ::PStore.new("#{self[:table_name]}.pstore")
end
find_by(**options) click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 47
def find_by(**options)
  all.find{ |record| options.all?{|k,v| record[k] == v } }
end
primary_key(key) click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 19
def primary_key(key)
  @_primary_key = key
end
table_name(value) click to toggle source
# File lib/aws/site_monitor/pstore_record.rb, line 23
def table_name(value)
  @_table_name = value
end