Class: SecureCredentials::Credentials
- Inherits:
-
Object
- Object
- SecureCredentials::Credentials
- Defined in:
- lib/secure_credentials/credentials.rb
Overview
Wraps store into compatible with Rails::Application#credentials interface.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(store) ⇒ Credentials
constructor
A new instance of Credentials.
-
#key ⇒ Object
Required by ‘rails encrypted` command.
Constructor Details
#initialize(store) ⇒ Credentials
Returns a new instance of Credentials.
13 14 15 |
# File 'lib/secure_credentials/credentials.rb', line 13 def initialize(store) @store = store end |
Instance Method Details
#data ⇒ Object
27 28 29 |
# File 'lib/secure_credentials/credentials.rb', line 27 def data @data ||= ActiveSupport::OrderedOptions.new.merge(store.content.deep_symbolize_keys) end |
#key ⇒ Object
Required by ‘rails encrypted` command.
21 22 23 24 25 |
# File 'lib/secure_credentials/credentials.rb', line 21 def key store.send(:encrypted_file).key if store.encrypted? rescue ActiveSupport::EncryptedFile::MissingKeyError nil end |