Class: Network::Commit

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
app/models/network/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_commit) ⇒ Commit

Returns a new instance of Commit


7
8
9
10
11
12
# File 'app/models/network/commit.rb', line 7

def initialize(raw_commit)
  @commit = raw_commit
  @time = -1
  @spaces = []
  @parent_spaces = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object


14
15
16
# File 'app/models/network/commit.rb', line 14

def method_missing(m, *args, &block)
  @commit.send(m, *args, &block)
end

Instance Attribute Details

#parent_spacesObject

Returns the value of attribute parent_spaces


5
6
7
# File 'app/models/network/commit.rb', line 5

def parent_spaces
  @parent_spaces
end

#spacesObject

Returns the value of attribute spaces


5
6
7
# File 'app/models/network/commit.rb', line 5

def spaces
  @spaces
end

#timeObject

Returns the value of attribute time


5
6
7
# File 'app/models/network/commit.rb', line 5

def time
  @time
end

Instance Method Details

#parents(map) ⇒ Object


26
27
28
29
30
31
32
33
# File 'app/models/network/commit.rb', line 26

def parents(map)
  @commit.parents.map do |p|
    if map.include?(p.id)
      map[p.id]
    end
  end
  .compact
end

#spaceObject


18
19
20
21
22
23
24
# File 'app/models/network/commit.rb', line 18

def space
  if @spaces.size > 0
    @spaces.first
  else
    0
  end
end