Class: Travis::Encrypt::Encryptor
- Inherits:
-
Object
- Object
- Travis::Encrypt::Encryptor
- Includes:
- Common
- Defined in:
- lib/travis/encrypt/encryptor.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
- #apply ⇒ Object
- #apply? ⇒ Boolean
-
#initialize(string, options) ⇒ Encryptor
constructor
A new instance of Encryptor.
Methods included from Common
#add_iv, #create_aes, #create_iv, #decode, #encode, #extract_iv
Constructor Details
#initialize(string, options) ⇒ Encryptor
Returns a new instance of Encryptor.
10 11 12 13 14 |
# File 'lib/travis/encrypt/encryptor.rb', line 10 def initialize(string, ) @string = string @key = [:key] || fail("Need to pass a key") @options = || {} end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/travis/encrypt/encryptor.rb', line 8 def key @key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/travis/encrypt/encryptor.rb', line 8 def @options end |
#string ⇒ Object (readonly)
Returns the value of attribute string.
8 9 10 |
# File 'lib/travis/encrypt/encryptor.rb', line 8 def string @string end |
Instance Method Details
#apply ⇒ Object
20 21 22 |
# File 'lib/travis/encrypt/encryptor.rb', line 20 def apply apply? ? encrypt : string end |
#apply? ⇒ Boolean
16 17 18 |
# File 'lib/travis/encrypt/encryptor.rb', line 16 def apply? !!string && !string.empty? && ![:disable] # TODO ask piotr end |