Class: ActiveEncryption::EncryptionSetting::YamlStore

Inherits:
Object
  • Object
show all
Defined in:
lib/active_encryption/encryption_setting/yaml_store.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ YamlStore

Returns a new instance of YamlStore.



15
16
17
# File 'lib/active_encryption/encryption_setting/yaml_store.rb', line 15

def initialize(file_path)
  @file_path = file_path
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



13
14
15
# File 'lib/active_encryption/encryption_setting/yaml_store.rb', line 13

def file_path
  @file_path
end

Instance Method Details

#contentObject



28
29
30
# File 'lib/active_encryption/encryption_setting/yaml_store.rb', line 28

def content
  @content ||= parse_file.deep_symbolize_keys
end

#find(id) ⇒ Object



19
20
21
22
23
24
25
26
# 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