Class: GitPissed::WordFinder
- Inherits:
-
Struct
- Object
- Struct
- GitPissed::WordFinder
- Defined in:
- lib/git_pissed/word_finder.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#revisions ⇒ Object
Returns the value of attribute revisions.
Instance Method Summary collapse
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options
2 3 4 |
# File 'lib/git_pissed/word_finder.rb', line 2 def @options end |
#revisions ⇒ Object
Returns the value of attribute revisions
2 3 4 |
# File 'lib/git_pissed/word_finder.rb', line 2 def revisions @revisions end |
Instance Method Details
#by_date ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/git_pissed/word_finder.rb', line 3 def by_date with_sorted_dates do |dates| revisions.each do |revision| date = git.date_for(revision) .words.each do |word| dates[date][word] = [ dates[date][word], git.count_for(word, revision) ].max .increment end end end end |
#git ⇒ Object
33 34 35 |
# File 'lib/git_pissed/word_finder.rb', line 33 def git Git.new() end |
#progress_bar ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/git_pissed/word_finder.rb', line 25 def @progress_bar ||= begin ProgressBar.create \ :total => (revisions.count * .words.count), :format => '%e <%B> %p%% %t' end end |
#with_sorted_dates {|dates| ... } ⇒ Object
19 20 21 22 23 |
# File 'lib/git_pissed/word_finder.rb', line 19 def with_sorted_dates dates = Hash.new { |hash, key| hash[key] = Hash.new(0) } yield dates dates.sort { |(k1, v1), (k2, v2)| k1 <=> k2 } end |