class ActiveEncryption::EncryptionSetting::YamlStore

The ActiveEncryption::EncryptionSetting::YamlStore class retrieve ActiveEncryption::EncryptionSetting::Record from a YAML file.

Attributes

file_path[R]

Public Class Methods

new(file_path) click to toggle source
# File lib/active_encryption/encryption_setting/yaml_store.rb, line 15
def initialize(file_path)
  @file_path = file_path
end

Public Instance Methods

content() click to toggle source
# File lib/active_encryption/encryption_setting/yaml_store.rb, line 28
def content
  @content ||= parse_file.deep_symbolize_keys
end
find(id) click to toggle source
# File lib/active_encryption/encryption_setting/yaml_store.rb, line 19
def find(id)
  id = id.to_sym
  attributes = content[id]
  return nil unless attributes

  attributes[:id] = id
  Record.new(attributes)
end

Private Instance Methods

parse_file() click to toggle source
# File lib/active_encryption/encryption_setting/yaml_store.rb, line 34
def parse_file
  YAML.safe_load(ERB.new(File.read(file_path)).result)
end