gitlab-dangerfiles 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 133950a9ab88093e18c6e394cadb8047a9975cd12b3f2cdec9167b07ca6677ff
4
- data.tar.gz: fde2b4a7c3c0639fbc4682447b655bb9dfc16fd3a1e616fd54aad48c117856de
3
+ metadata.gz: 9b9595ceec9ab34fce54bc76f5a37cbce7bbfeea2abacf3b778ba818598a49c6
4
+ data.tar.gz: 5ca0dfc8e1b1e10f5d9baed64e97324e9e4429069fc30321d87eb1ddbb8df153
5
5
  SHA512:
6
- metadata.gz: 55f2fb30261069530f151eef6396346abd7769fe0fdfde7b5e9f81a15aa70d81ba9ff63d3981b4aed62154563fefdfb0df9a12e39e2ed33a011c8315f372906f
7
- data.tar.gz: b4abb0b2a90c088cd5a499b35ab2cc99dcbb579f61a0839056a8b8d910134e0cda0b5d1b5323a975fb48fa0afa5e8d86b4ea5cdc01317725e5e4893bd2658b83
6
+ metadata.gz: 9920bc082fb11316a74dbd73f790d024e7166cbfe6934c224fb12de700d0430aafbd25039a1a6b019bfc5f2b4616a3de00ca0824faf70425b33d6642051d7778
7
+ data.tar.gz: 4738a771af153b99dc713d0c711d8cf1ec54e5f85bb10f3e342ed26bc49a8259b0d6d95bd37173f8f746296d51935d111b263055b0c0470c7ca28356f1b3855d
@@ -3,19 +3,31 @@
3
3
  module Gitlab
4
4
  module Dangerfiles
5
5
  class Teammate
6
- attr_reader :username, :name, :role, :projects, :available, :tz_offset_hours
6
+ attr_reader :options, :username, :name, :role, :projects, :available, :hungry, :tz_offset_hours
7
7
 
8
8
  # The options data are produced by https://gitlab.com/gitlab-org/gitlab-roulette/-/blob/master/lib/team_member.rb
9
9
  def initialize(options = {})
10
+ @options = options
10
11
  @username = options["username"]
11
12
  @name = options["name"]
12
13
  @markdown_name = options["markdown_name"]
13
14
  @role = options["role"]
14
15
  @projects = options["projects"]
15
16
  @available = options["available"]
17
+ @hungry = options["hungry"]
16
18
  @tz_offset_hours = options["tz_offset_hours"]
17
19
  end
18
20
 
21
+ def to_h
22
+ options
23
+ end
24
+
25
+ def ==(other)
26
+ return false unless other.respond_to?(:username)
27
+
28
+ other.username == username
29
+ end
30
+
19
31
  def in_project?(name)
20
32
  projects&.has_key?(name)
21
33
  end
@@ -34,9 +46,7 @@ module Gitlab
34
46
  has_capability?(project, category, :maintainer, labels)
35
47
  end
36
48
 
37
- def markdown_name(timezone_experiment: false, author: nil)
38
- return @markdown_name unless timezone_experiment
39
-
49
+ def markdown_name(author: nil)
40
50
  "#{@markdown_name} (#{utc_offset_text(author)})"
41
51
  end
42
52
 
@@ -68,9 +78,9 @@ module Gitlab
68
78
 
69
79
  def offset_diff_compared_to_author(author)
70
80
  diff = floored_offset_hours - author.floored_offset_hours
71
- return "same timezone as `@#{author.username}`" if diff.zero?
81
+ return "same timezone as `@#{author.username}`" if diff == 0
72
82
 
73
- ahead_or_behind = diff < 0 ? "behind" : "ahead"
83
+ ahead_or_behind = diff < 0 ? "behind" : "ahead of"
74
84
  pluralized_hours = pluralize(diff.abs, "hour", "hours")
75
85
 
76
86
  "#{pluralized_hours} #{ahead_or_behind} `@#{author.username}`"
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module Dangerfiles
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-dangerfiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémy Coutable
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2020-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danger