Sha256: 374edb0a465201f8bd65f4cd724bc807dd552db16e329a511a4588ee105e8d59

Contents?: true

Size: 1.05 KB

Versions: 15

Compression:

Stored size: 1.05 KB

Contents

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

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

  def initialize(options = {})
    super

    first_settings_options        = options.merge(namespaces: options[:first])
    self.first_settings_instance  = Chamber::Instance.new(first_settings_options)

    second_settings_options       = options.merge(namespaces: options[:second])
    self.second_settings_instance = Chamber::Instance.new(second_settings_options)
  end

  def self.call(options = {})
    self.new(options).call
  end

  protected

  attr_accessor :first_settings_instance,
                :second_settings_instance

  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

15 entries across 15 versions & 1 rubygems

Version Path
chamber-2.4.0 lib/chamber/commands/compare.rb
chamber-2.3.2 lib/chamber/commands/compare.rb
chamber-2.3.1 lib/chamber/commands/compare.rb
chamber-2.3.0 lib/chamber/commands/compare.rb
chamber-2.2.1 lib/chamber/commands/compare.rb
chamber-2.2.0 lib/chamber/commands/compare.rb
chamber-2.1.9 lib/chamber/commands/compare.rb
chamber-2.1.8 lib/chamber/commands/compare.rb
chamber-2.1.7 lib/chamber/commands/compare.rb
chamber-2.1.6 lib/chamber/commands/compare.rb
chamber-2.1.3 lib/chamber/commands/compare.rb
chamber-2.1.2 lib/chamber/commands/compare.rb
chamber-2.1.1 lib/chamber/commands/compare.rb
chamber-2.1.0 lib/chamber/commands/compare.rb
chamber-2.0.0 lib/chamber/commands/compare.rb