Module: EasyType::EncryptedProperty

Defined in:
lib/easy_type/encrypted_property.rb

Overview

Contains the base methods for handeling an encrypted property.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(parent) ⇒ Object



11
12
13
14
# File 'lib/easy_type/encrypted_property.rb', line 11

def self.included(parent)
  parent.extend(ClassMethods)
  parent.include( Parameter)
end

Instance Method Details

#change_to_s(currentvalue, _newvalue) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/easy_type/encrypted_property.rb', line 21

def change_to_s(currentvalue, _newvalue)
  if currentvalue == :absent
    'created with specified value'
  else
    'changed to new value'
  end
end

#insync?(_is) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/easy_type/encrypted_property.rb', line 16

def insync?(_is)
  raise 'You must define the method current_value for encrypted properties' unless method(:current_value)
  current_value == should
end

#is_to_s(_currentvalue) ⇒ Object

rubocop:disable Style/PredicateName



30
31
32
# File 'lib/easy_type/encrypted_property.rb', line 30

def is_to_s(_currentvalue)
  '[old encrypted value]'
end

#should_to_s(_newvalue) ⇒ Object

rubocop:enable Style/PredicateName



35
36
37
# File 'lib/easy_type/encrypted_property.rb', line 35

def should_to_s(_newvalue)
  '[new encrypted value]'
end