Class: Gitloggl::Gitlab::Issue

Inherits:
Struct
  • Object
show all
Defined in:
lib/gitloggl/gitlab/issue.rb

Constant Summary collapse

ISSUE_PATH_RE =

“poslogic-partner#471”

/([[[:alnum:]]_-]*)#(\d+)/

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#notesObject

Returns the value of attribute notes.



6
7
8
# File 'lib/gitloggl/gitlab/issue.rb', line 6

def notes
  @notes
end

#project_idObject

Returns the value of attribute project_id

Returns:

  • (Object)

    the current value of project_id



3
4
5
# File 'lib/gitloggl/gitlab/issue.rb', line 3

def project_id
  @project_id
end

#spent_msObject

Returns the value of attribute spent_ms

Returns:

  • (Object)

    the current value of spent_ms



3
4
5
# File 'lib/gitloggl/gitlab/issue.rb', line 3

def spent_ms
  @spent_ms
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



3
4
5
# File 'lib/gitloggl/gitlab/issue.rb', line 3

def title
  @title
end

Instance Method Details

#+(issue) ⇒ Object



19
20
21
22
# File 'lib/gitloggl/gitlab/issue.rb', line 19

def +(issue)
  self.spent_ms = spent_ms + issue.spent_ms
  self
end

#pathObject



12
13
14
15
16
17
# File 'lib/gitloggl/gitlab/issue.rb', line 12

def path
  return nil unless title =~ ISSUE_PATH_RE
  return nil unless $1.present? && $2.present?

  @path ||= OpenStruct.new(project_path: $1, issue_id: $2)
end

#spent_secObject



8
9
10
# File 'lib/gitloggl/gitlab/issue.rb', line 8

def spent_sec
  spent_ms.fdiv(1000).round
end