lib/churn/churn_calculator.rb in churn-0.0.4 vs lib/churn/churn_calculator.rb in churn-0.0.5

- old
+ new

@@ -17,13 +17,14 @@ def initialize(options={}) start_date = options.fetch(:start_date) { '3 months ago' } @minimum_churn_count = options.fetch(:minimum_churn_count) { 5 } @source_control = set_source_control(start_date) + @changes = {} @revision_changes = {} - @method_changes = {} @class_changes = {} + @method_changes = {} end def report(print = true) self.emit self.analyze @@ -85,10 +86,14 @@ result += display_array(hash[:churn][:method_churn]) end private + def filters + /.*\.rb/ + end + def display_array(array) result = "" array.each { |element| result += " * #{element.inspect}\n" } if array result end @@ -132,10 +137,10 @@ changed_files = parse_logs_for_updated_files(revision, @revisions) changed_classes = [] changed_methods = [] changed_files.each do |file_changes| - if file_changes.first.match(/.*\.rb/) + if file_changes.first.match(filters) classes, methods = get_changes(file_changes) changed_classes += classes changed_methods += methods end end