Method: Dotenv::Diff#initialize

Defined in:
lib/dotenv/diff.rb

#initialize(a: snapshot, b: ENV) {|diff| ... } ⇒ Diff

Create a new diff. If given a block, the state of ENV after the block will be preserved as the final state for comparison. Otherwise, the current ENV will be the final state.

Parameters:

  • a (Hash) (defaults to: snapshot)

    the initial state, defaults to a snapshot of current ENV

  • b (Hash) (defaults to: ENV)

    the final state, defaults to the current ENV

Yields:

  • (diff)

    a block to execute before recording the final state



16
17
18
19
20
21
# File 'lib/dotenv/diff.rb', line 16

def initialize(a: snapshot, b: ENV, &block)
  @a, @b = a, b
  block&.call self
ensure
  @b = snapshot if block
end