Module: GraphHelper
- Defined in:
- app/helpers/graph_helper.rb
Instance Method Summary collapse
- #parents_zip_spaces(parents, parent_spaces) ⇒ Object
- #refs(repo, commit) ⇒ Object
- #success_ratio(counts) ⇒ Object
Instance Method Details
#parents_zip_spaces(parents, parent_spaces) ⇒ Object
14 15 16 17 |
# File 'app/helpers/graph_helper.rb', line 14 def parents_zip_spaces(parents, parent_spaces) ids = parents.map { |p| p.id } ids.zip(parent_spaces) end |
#refs(repo, commit) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/graph_helper.rb', line 4 def refs(repo, commit) refs = [commit.ref_names(repo).join(' ')] # append note count notes_count = @graph.notes[commit.id] refs << "[#{pluralize(notes_count, 'note')}]" if notes_count > 0 refs.join end |
#success_ratio(counts) ⇒ Object
19 20 21 22 23 24 |
# File 'app/helpers/graph_helper.rb', line 19 def success_ratio(counts) return 100 if counts[:failed] == 0 ratio = (counts[:success].to_f / (counts[:success] + counts[:failed])) * 100 ratio.to_i end |