Class: Chamber::Instance
- Inherits:
-
Object
- Object
- Chamber::Instance
- Defined in:
- lib/chamber/instance.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#files ⇒ Object
Returns the value of attribute files.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #decrypt(data, **args) ⇒ Object
- #dig(*args) ⇒ Object
- #dig!(*args) ⇒ Object
- #encrypt(data, **args) ⇒ Object
- #filenames ⇒ Object
-
#initialize(**args) ⇒ Instance
constructor
A new instance of Instance.
- #namespaces ⇒ Object
- #secure ⇒ Object
- #settings ⇒ Object
- #sign ⇒ Object
- #to_environment ⇒ Object
- #to_hash ⇒ Object
- #to_s(**args) ⇒ Object
- #unsecure ⇒ Object
- #verify ⇒ Object
Constructor Details
#initialize(**args) ⇒ Instance
Returns a new instance of Instance.
12 13 14 15 |
# File 'lib/chamber/instance.rb', line 12 def initialize(**args) self.configuration = Configuration.new(**args) self.files = FileSet.new(**configuration.to_hash) end |
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
9 10 11 |
# File 'lib/chamber/instance.rb', line 9 def configuration @configuration end |
#files ⇒ Object
Returns the value of attribute files.
9 10 11 |
# File 'lib/chamber/instance.rb', line 9 def files @files end |
Instance Method Details
#[](key) ⇒ Object
21 22 23 |
# File 'lib/chamber/instance.rb', line 21 def [](key) settings.[](key) end |
#decrypt(data, **args) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/chamber/instance.rb', line 83 def decrypt(data, **args) config = configuration.to_hash.merge(**args) Settings .new( **config.merge( settings: data, pre_filters: [Filters::NamespaceFilter], post_filters: [ Filters::DecryptionFilter, Filters::FailedDecryptionFilter, ], ), ) .to_hash end |
#dig(*args) ⇒ Object
29 30 31 |
# File 'lib/chamber/instance.rb', line 29 def dig(*args) settings.dig(*args) end |
#dig!(*args) ⇒ Object
25 26 27 |
# File 'lib/chamber/instance.rb', line 25 def dig!(*args) settings.dig!(*args) end |
#encrypt(data, **args) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/chamber/instance.rb', line 69 def encrypt(data, **args) config = configuration.to_hash.merge(**args) Settings .new( **config.merge( settings: data, pre_filters: [Filters::EncryptionFilter], post_filters: [], ), ) .to_hash end |
#filenames ⇒ Object
33 34 35 |
# File 'lib/chamber/instance.rb', line 33 def filenames files.filenames end |
#namespaces ⇒ Object
65 66 67 |
# File 'lib/chamber/instance.rb', line 65 def namespaces settings.namespaces end |
#secure ⇒ Object
37 38 39 |
# File 'lib/chamber/instance.rb', line 37 def secure files.secure end |
#settings ⇒ Object
17 18 19 |
# File 'lib/chamber/instance.rb', line 17 def settings @settings ||= files.to_settings { |settings| @settings = settings } end |
#sign ⇒ Object
45 46 47 |
# File 'lib/chamber/instance.rb', line 45 def sign files.sign end |
#to_environment ⇒ Object
53 54 55 |
# File 'lib/chamber/instance.rb', line 53 def to_environment settings.to_environment end |
#to_hash ⇒ Object
61 62 63 |
# File 'lib/chamber/instance.rb', line 61 def to_hash settings.to_hash end |
#to_s(**args) ⇒ Object
57 58 59 |
# File 'lib/chamber/instance.rb', line 57 def to_s(**args) settings.to_s(**args) end |
#unsecure ⇒ Object
41 42 43 |
# File 'lib/chamber/instance.rb', line 41 def unsecure files.unsecure end |
#verify ⇒ Object
49 50 51 |
# File 'lib/chamber/instance.rb', line 49 def verify files.verify end |