Sha256: 99ebf3777cd0d019107054df1aace9ae20a95cc2a549c434b1c505677c89f4d8

Contents?: true

Size: 966 Bytes

Versions: 10

Compression:

Stored size: 966 Bytes

Contents

# frozen_string_literal: true

require 'chamber/instance'
require 'chamber/commands/base'
require 'chamber/commands/comparable'

module  Chamber
module  Commands
class   Compare < Chamber::Commands::Base
  include Chamber::Commands::Comparable

  attr_accessor :first_settings_instance,
                :second_settings_instance

  def self.call(**args)
    new(**args).call
  end

  def initialize(first:, second:, **args)
    super(**args)

    self.first_settings_instance  = Chamber::Instance.new(args.merge(namespaces: first))
    self.second_settings_instance = Chamber::Instance.new(args.merge(namespaces: second))
  end

  protected

  def first_settings_data
    settings_data(first_settings_instance)
  end

  def second_settings_data
    settings_data(second_settings_instance)
  end

  def settings_data(instance)
    if keys_only
      instance.to_environment.keys.join("\n")
    else
      instance.to_s(pair_separator: "\n")
    end
  end
end
end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
chamber-3.1.1 lib/chamber/commands/compare.rb
chamber-3.1.0 lib/chamber/commands/compare.rb
chamber-3.0.1 lib/chamber/commands/compare.rb
chamber-3.0.0 lib/chamber/commands/compare.rb
chamber-3.0.0rc2 lib/chamber/commands/compare.rb
chamber-2.14.3 lib/chamber/commands/compare.rb
chamber-3.0.0rc1 lib/chamber/commands/compare.rb
chamber-2.14.2 lib/chamber/commands/compare.rb
chamber-2.14.1 lib/chamber/commands/compare.rb
chamber-2.14.0 lib/chamber/commands/compare.rb