Class: Rollgeist::Mark

Inherits:
Object
  • Object
show all
Defined in:
lib/rollgeist/mark.rb

Constant Summary collapse

ACTIONS =
%i[create update destroy].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, changed_attributes:, rollback_location:, rolled_back_at:) ⇒ Mark

Returns a new instance of Mark.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
# File 'lib/rollgeist/mark.rb', line 9

def initialize(action:, changed_attributes:, rollback_location:, rolled_back_at:)
  raise ArgumentError, "unsupported rollback action: #{action}" unless ACTIONS.include?(action)

  @action = action
  @changed_attributes = changed_attributes.map(&:to_s).uniq.freeze
  @rollback_location = rollback_location
  @rolled_back_at = rolled_back_at
  freeze
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



7
8
9
# File 'lib/rollgeist/mark.rb', line 7

def action
  @action
end

#changed_attributesObject (readonly)

Returns the value of attribute changed_attributes.



7
8
9
# File 'lib/rollgeist/mark.rb', line 7

def changed_attributes
  @changed_attributes
end

#rollback_locationObject (readonly)

Returns the value of attribute rollback_location.



7
8
9
# File 'lib/rollgeist/mark.rb', line 7

def rollback_location
  @rollback_location
end

#rolled_back_atObject (readonly)

Returns the value of attribute rolled_back_at.



7
8
9
# File 'lib/rollgeist/mark.rb', line 7

def rolled_back_at
  @rolled_back_at
end