Class: Rummage::Github::Network
- Inherits:
-
Object
- Object
- Rummage::Github::Network
- Includes:
- HTTParty
- Defined in:
- lib/rummage.rb
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(uri) ⇒ Network
constructor
Parsing input string.
-
#network_data_chunk(nethash, options = {}) ⇒ Object
Get repo network data chunk github.com/rgrove/sanitize/network_data_chunk.
-
#network_meta ⇒ Object
Get repo network meta github.com/rgrove/sanitize/network_meta.
Constructor Details
#initialize(uri) ⇒ Network
Parsing input string
14 15 16 |
# File 'lib/rummage.rb', line 14 def initialize uri @user, @repo = URI.parse(uri).path.split('/').delete_if(&:empty?) end |
Instance Method Details
#draw ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rummage.rb', line 30 def draw = users = .users commits = network_data_chunk(.nethash) users.each do |user| user.heads.each do |head| head.commits = [] commit = commits.select { |e| e.id == head.id }.first loop do head.commits.push commit # проверка на head'овость этого коммита в другом своем head'e if !commit.parents.empty? && commit.parents.first[2] == commit.space && !user.heads.map(&:id).include?(commit.parents.first[0]) commit = commits.select { |e| e.id == commit.parents.first[0] }.first else break end end end end users end |
#network_data_chunk(nethash, options = {}) ⇒ Object
Get repo network data chunk github.com/rgrove/sanitize/network_data_chunk
26 27 28 |
# File 'lib/rummage.rb', line 26 def network_data_chunk nethash, = {} get( urlize(@user, @repo, "network_data_chunk"), :query => .merge(:nethash => nethash) ).commits end |
#network_meta ⇒ Object
Get repo network meta github.com/rgrove/sanitize/network_meta
20 21 22 |
# File 'lib/rummage.rb', line 20 def get( urlize(@user, @repo, "network_meta") ) end |