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.



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

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(msg, *args, &block) ⇒ Object



16
17
18
# File 'app/models/network/commit.rb', line 16

def method_missing(msg, *args, &block)
  @commit.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend
end

Instance Attribute Details

#parent_spacesObject

Returns the value of attribute parent_spaces.



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

def parent_spaces
  @parent_spaces
end

#spacesObject

Returns the value of attribute spaces.



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

def spaces
  @spaces
end

#timeObject

Returns the value of attribute time.



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

def time
  @time
end

Instance Method Details

#parents(map) ⇒ Object



28
29
30
# File 'app/models/network/commit.rb', line 28

def parents(map)
  map.values_at(*@commit.parent_ids).compact
end

#spaceObject



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

def space
  if @spaces.present?
    @spaces.first
  else
    0
  end
end