Class: ActiveEncryption::EncryptionSetting::YamlStore
- Inherits:
-
Object
- Object
- ActiveEncryption::EncryptionSetting::YamlStore
- 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
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
- #content ⇒ Object
- #find(id) ⇒ Object
-
#initialize(file_path) ⇒ YamlStore
constructor
A new instance of YamlStore.
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_path ⇒ Object (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
#content ⇒ Object
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 |