Class: Chamber::Instance
- Inherits:
-
Object
show all
- Defined in:
- lib/chamber/instance.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Instance
Returns a new instance of Instance.
12
13
14
15
|
# File 'lib/chamber/instance.rb', line 12
def initialize(options = {})
self.configuration = Configuration.new options
self.files = FileSet.new configuration.to_hash
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
72
73
74
75
76
|
# File 'lib/chamber/instance.rb', line 72
def method_missing(name, *args)
return settings.public_send(name, *args) if settings.respond_to?(name)
super
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
#decrypt(data, options = {}) ⇒ Object
#encrypt(data, options = {}) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/chamber/instance.rb', line 37
def encrypt(data, options = {})
config = configuration.to_hash.merge(options)
Settings.
new(
config.merge(
settings: data,
pre_filters: [Filters::EncryptionFilter],
post_filters: [],
),
).
to_hash
end
|
#filenames ⇒ Object
21
22
23
|
# File 'lib/chamber/instance.rb', line 21
def filenames
files.filenames
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
78
79
80
|
# File 'lib/chamber/instance.rb', line 78
def respond_to_missing?(name, include_private = false)
settings.respond_to?(name, include_private)
end
|
#secure ⇒ Object
25
26
27
|
# File 'lib/chamber/instance.rb', line 25
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
29
30
31
|
# File 'lib/chamber/instance.rb', line 29
def sign
files.sign
end
|
#to_s(options = {}) ⇒ Object
68
69
70
|
# File 'lib/chamber/instance.rb', line 68
def to_s(options = {})
settings.to_s(options)
end
|
#verify ⇒ Object
33
34
35
|
# File 'lib/chamber/instance.rb', line 33
def verify
files.verify
end
|