Sha256: 5ea3a05037c79425b6e63d601f4c7633dddcc150b6fe753505c15f53b43c35b1

Contents?: true

Size: 936 Bytes

Versions: 1

Compression:

Stored size: 936 Bytes

Contents

class Configuration
  attr_accessor :excluded_models, :output_path, :comparison_level

  DEFAULT_COMPARISON_LEVEL = 1

  COMPARISON_LEVELS = {
    1 => :quick,
    2 => :novice,
    3 => :extensive,
    4 => :full
  }

  def initialize(excluded_models: [], output_path: "db_mirrored", comparison_level: DEFAULT_COMPARISON_LEVEL)
    self.excluded_models = excluded_models
    self.output_path = output_path
    self.comparison_level = COMPARISON_LEVELS[comparison_level] || DEFAULT_COMPARISON_LEVEL
  end

  def valid_attributes!
    if !excluded_models.is_a?(Array)
      raise("Invalid excluded_models value! Was expecting an array")
    end

    if !output_path.present?
      raise("Invalid output_path value! Expected non empty string")
    end

    if COMPARISON_LEVELS.invert[comparison_level].nil?
      raise("Invalid comparison_level value! Expected a value between 1-4")
    end
  end

  def from_hash(hash_object)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
db_mirror-0.0.1 lib/cli/app/configuration.rb