Class: FlipperTrail::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/flipper_trail/entry.rb

Overview

An immutable record of a single feature-flag change: which feature and gate, the operation, the before/after state, the Actor, and when it happened.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actorActor?

Returns who made the change.

Returns:

  • (Actor, nil)

    who made the change



22
23
24
25
26
27
28
29
30
# File 'lib/flipper_trail/entry.rb', line 22

Entry = Struct.new(
  :feature_name, :operation, :gate_name, :before, :after, :actor, :created_at,
  keyword_init: true
) do
  # @return [Boolean] whether the change altered the feature's state
  def changed?
    before != after
  end
end

#afterObject

Returns the gate state after the change.

Returns:

  • (Object)

    the gate state after the change



22
23
24
25
26
27
28
29
30
# File 'lib/flipper_trail/entry.rb', line 22

Entry = Struct.new(
  :feature_name, :operation, :gate_name, :before, :after, :actor, :created_at,
  keyword_init: true
) do
  # @return [Boolean] whether the change altered the feature's state
  def changed?
    before != after
  end
end

#beforeObject

Returns the gate state before the change.

Returns:

  • (Object)

    the gate state before the change



22
23
24
25
26
27
28
29
30
# File 'lib/flipper_trail/entry.rb', line 22

Entry = Struct.new(
  :feature_name, :operation, :gate_name, :before, :after, :actor, :created_at,
  keyword_init: true
) do
  # @return [Boolean] whether the change altered the feature's state
  def changed?
    before != after
  end
end

#created_atTime

Returns when the change was recorded.

Returns:

  • (Time)

    when the change was recorded



22
23
24
25
26
27
28
29
30
# File 'lib/flipper_trail/entry.rb', line 22

Entry = Struct.new(
  :feature_name, :operation, :gate_name, :before, :after, :actor, :created_at,
  keyword_init: true
) do
  # @return [Boolean] whether the change altered the feature's state
  def changed?
    before != after
  end
end

#feature_nameString

Returns the feature key.

Returns:

  • (String)

    the feature key



22
23
24
25
26
27
28
29
30
# File 'lib/flipper_trail/entry.rb', line 22

Entry = Struct.new(
  :feature_name, :operation, :gate_name, :before, :after, :actor, :created_at,
  keyword_init: true
) do
  # @return [Boolean] whether the change altered the feature's state
  def changed?
    before != after
  end
end

#gate_nameString?

Returns the gate affected, if any.

Returns:

  • (String, nil)

    the gate affected, if any



22
23
24
25
26
27
28
29
30
# File 'lib/flipper_trail/entry.rb', line 22

Entry = Struct.new(
  :feature_name, :operation, :gate_name, :before, :after, :actor, :created_at,
  keyword_init: true
) do
  # @return [Boolean] whether the change altered the feature's state
  def changed?
    before != after
  end
end

#operationSymbol

Returns the write performed (‘:add`, `:remove`, `:clear`, `:enable`, `:disable`).

Returns:

  • (Symbol)

    the write performed (‘:add`, `:remove`, `:clear`, `:enable`, `:disable`)



22
23
24
25
26
27
28
29
30
# File 'lib/flipper_trail/entry.rb', line 22

Entry = Struct.new(
  :feature_name, :operation, :gate_name, :before, :after, :actor, :created_at,
  keyword_init: true
) do
  # @return [Boolean] whether the change altered the feature's state
  def changed?
    before != after
  end
end

Instance Method Details

#changed?Boolean

Returns whether the change altered the feature’s state.

Returns:

  • (Boolean)

    whether the change altered the feature’s state



27
28
29
# File 'lib/flipper_trail/entry.rb', line 27

def changed?
  before != after
end