Class: ActiveRecord::Journal::Journable::Changes

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_record/journal/journable/changes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



6
7
8
# File 'lib/active_record/journal/journable/changes.rb', line 6

def action
  @action
end

#keysObject

Returns the value of attribute keys

Returns:

  • (Object)

    the current value of keys



6
7
8
# File 'lib/active_record/journal/journable/changes.rb', line 6

def keys
  @keys
end

#mask_keysObject

Returns the value of attribute mask_keys

Returns:

  • (Object)

    the current value of mask_keys



6
7
8
# File 'lib/active_record/journal/journable/changes.rb', line 6

def mask_keys
  @mask_keys
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



6
7
8
# File 'lib/active_record/journal/journable/changes.rb', line 6

def subject
  @subject
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
# File 'lib/active_record/journal/journable/changes.rb', line 7

def call
  changes.each_with_object({}) do |(key, value), attrs|
    attrs[key] = value
    next unless mask_keys&.include?(key)

    attrs[key] = value.is_a?(Array) ? [nil, nil] : nil
  end
end