Class: Encryption::Symmetric
- Inherits:
-
Object
- Object
- Encryption::Symmetric
show all
- Defined in:
- lib/modules/symmetric.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Symmetric.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/modules/symmetric.rb', line 10
def method_missing(name, *args, &block)
if @configuration.respond_to? name
return @configuration.send(name, *args, &block)
end
super
end
|
Instance Method Details
#decrypt(data) ⇒ Object
27
28
29
30
|
# File 'lib/modules/symmetric.rb', line 27
def decrypt(data)
cipher_init(:decipher, :decrypt)
@decipher.update(data) + @decipher.final
end
|
#encrypt(data) ⇒ Object
22
23
24
25
|
# File 'lib/modules/symmetric.rb', line 22
def encrypt(data)
cipher_init(:cipher, :encrypt)
@cipher.update(data) + @cipher.final
end
|
#respond_to?(name, include_all = false) ⇒ Boolean
17
18
19
20
|
# File 'lib/modules/symmetric.rb', line 17
def respond_to?(name, include_all = false)
return true if @configuration.respond_to? name
super
end
|