Class: Twigg::RussianNovel
- Inherits:
-
Object
- Object
- Twigg::RussianNovel
- Defined in:
- lib/twigg/russian_novel.rb
Instance Method Summary collapse
-
#data ⇒ Object
Returns Russian Novel data in a d3-friendly format.
-
#initialize(commit_set) ⇒ RussianNovel
constructor
The class takes a CommitSet and produces data that can be used to produce a d3 bubble chart:.
Constructor Details
#initialize(commit_set) ⇒ RussianNovel
The class takes a CommitSet and produces data that can be used to produce a d3 bubble chart:
https://github.com/mbostock/d3/wiki/Pack-Layout
http://bl.ocks.org/mbostock/4063269
The bubble chart is an excellent format for representing the “Russianness” of an author’s commit messages:
- size: commit line count (also known as "Russianness")
- text: name
- hover: detailed stats on "Russianness", Flesch Reading Ease score,
and team name
- color: team
18 19 20 |
# File 'lib/twigg/russian_novel.rb', line 18 def initialize(commit_set) @commit_set = commit_set end |
Instance Method Details
#data ⇒ Object
Returns Russian Novel data in a d3-friendly format.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/twigg/russian_novel.rb', line 23 def data @data ||= begin team_map = Team. children = @commit_set..map do |object| { 'author' => object[:author], 'russianness' => object[:commit_set].russianness, 'flesch_reading_ease' => object[:commit_set].flesch_reading_ease, 'team' => team_map[object[:author]], } end { 'children' => children } end end |