Sha256: b795e61caceb4ba8fadeaf9ac56094e0c1ff416124b4154109a2c5f8eab14441
Contents?: true
Size: 1.64 KB
Versions: 3
Compression:
Stored size: 1.64 KB
Contents
require 'singleton' module Churn # responsible for storing the churn configuration class ChurnOptions DEFAULT_CHURN_DIRECTORY = "tmp/churn" DEFAULT_MINIMUM_CHURN_COUNT = 5 DEFAULT_START_TIME = '3 months ago' attr_accessor :data_directory, :minimum_churn_count, :ignores, :start_date, :history, :name, :file_extension, :file_prefix def initialize() @data_directory = DEFAULT_CHURN_DIRECTORY @minimum_churn_count = DEFAULT_MINIMUM_CHURN_COUNT @ignores = '/dev/null' @start_date = DEFAULT_START_TIME @history = nil @name = nil @file_extension = nil @file_prefix = nil end def set_options(options = {}) @data_directory = options.fetch(:data_directory){ @data_directory } unless options[:data_directory]=='' @file_extension = options.fetch(:file_extension){ @file_extension } unless options[:file_extension]=='' @file_prefix = options.fetch(:file_prefix){ @file_prefix } unless options[:file_prefix]=='' @minimum_churn_count = options.fetch(:minimum_churn_count){ @minimum_churn_count }.to_i @ignores = (options.fetch(:ignore_files){ options[:ignores] || @ignores }).to_s.split(',').map(&:strip) @ignores << '/dev/null' unless @ignores.include?('/dev/null') @start_date = options[:start_date] if !options[:start_date].nil? && options[:start_date]!='' @history = options[:history] if !options[:history].nil? && options[:history]!='' if @history=='true' @history = DEFAULT_START_TIME end self end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
churn-1.0.8 | lib/churn/options.rb |
churn-1.0.7 | lib/churn/options.rb |
churn-1.0.6 | lib/churn/options.rb |