Class: Churn::ChurnHistory

### Home Classes Methods

### In Files

- lib/churn/churn_history.rb

### Parent

Object

### Methods

- ::load_revision_data
- ::store_revision_history

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Churn
- Churn::ChurnCalculator
- Churn::ChurnHistory
- Churn::GitAnalyzer
- Churn::HgAnalyzer
- Churn::LocationMapping
- Churn::SourceControl
- Churn::SvnAnalyzer
- Object

No matching classes.

# Churn::ChurnHistory

### Public Class Methods

load_revision_data(revision) click to toggle source

    # File lib/churn/churn_history.rb, line 10
    def self.load_revision_data(revision)
      #load revision data from scratch folder if it exists
      filename = "tmp/#{revision}.json"
      if File.exists?(filename)
        begin
          json_data = File.read(filename)
          data      = JSON.parse(json_data)
          changed_files   = data['churn']['changed_files']
          changed_classes = data['churn']['changed_classes']
          changed_methods = data['churn']['changed_methods']
        rescue JSON::ParserError
          #leave all of the objects nil
        end
      end
      [changed_files, changed_classes, changed_methods]
    end

store_revision_history(revision, hash_data) click to toggle source

    # File lib/churn/churn_history.rb, line 5
    def self.store_revision_history(revision, hash_data)
      FileUtils.mkdir 'tmp' unless File.directory?('tmp')
      File.open("tmp/#{revision}.json", 'w') {|f| f.write(hash_data.to_json) }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.