Class: CodeTeams::Team

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/code_teams.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_yml:, raw_hash:) ⇒ Team

Returns a new instance of Team.



101
102
103
104
# File 'lib/code_teams.rb', line 101

def initialize(config_yml:, raw_hash:)
  @config_yml = config_yml
  @raw_hash = raw_hash
end

Instance Attribute Details

#config_ymlObject (readonly)

Returns the value of attribute config_yml.



93
94
95
# File 'lib/code_teams.rb', line 93

def config_yml
  @config_yml
end

#raw_hashObject (readonly)

Returns the value of attribute raw_hash.



90
91
92
# File 'lib/code_teams.rb', line 90

def raw_hash
  @raw_hash
end

Class Method Details

.from_hash(raw_hash) ⇒ Object



82
83
84
85
86
87
# File 'lib/code_teams.rb', line 82

def self.from_hash(raw_hash)
  new(
    config_yml: nil,
    raw_hash: raw_hash
  )
end

.from_yml(config_yml) ⇒ Object



72
73
74
75
76
77
78
79
# File 'lib/code_teams.rb', line 72

def self.from_yml(config_yml)
  hash = YAML.load_file(config_yml)

  new(
    config_yml: config_yml,
    raw_hash: hash
  )
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



117
118
119
120
121
122
123
# File 'lib/code_teams.rb', line 117

def ==(other)
  if other.is_a?(CodeTeams::Team)
    self.name == other.name
  else
    false
  end
end

#hashObject

rubocop:disable Rails/Delegate



128
129
130
# File 'lib/code_teams.rb', line 128

def hash # rubocop:disable Rails/Delegate
  name.hash
end

#nameObject



107
108
109
# File 'lib/code_teams.rb', line 107

def name
  Plugins::Identity.for(self).identity.name
end

#to_tagObject



112
113
114
# File 'lib/code_teams.rb', line 112

def to_tag
  CodeTeams.tag_value_for(name)
end