Class: EncryptedField::BasePolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/encrypted-field/base_policy.rb

Overview

EncryptedField::BasePolicy abstract class for creating encryption policies

Direct Known Subclasses

PolicyWithIV, PolicyWithoutIV

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(algorithm, secret_key, options = {}) ⇒ BasePolicy

Returns a new instance of BasePolicy.



12
13
14
15
16
# File 'lib/encrypted-field/base_policy.rb', line 12

def initialize(algorithm, secret_key, options = {})
  @algorithm = algorithm
  @secret_key = secret_key
  @options = options
end

Instance Attribute Details

#algorithmObject (readonly)

Returns the value of attribute algorithm.



9
10
11
# File 'lib/encrypted-field/base_policy.rb', line 9

def algorithm
  @algorithm
end

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/encrypted-field/base_policy.rb', line 9

def options
  @options
end

Instance Method Details

#prefix_with_policy_name?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/encrypted-field/base_policy.rb', line 18

def prefix_with_policy_name?
  options.fetch(:prefix_with_policy_name, true)
end