Class: Teams::Team

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/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.



100
101
102
103
# File 'lib/teams.rb', line 100

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.



92
93
94
# File 'lib/teams.rb', line 92

def config_yml
  @config_yml
end

#raw_hashObject (readonly)

Returns the value of attribute raw_hash.



89
90
91
# File 'lib/teams.rb', line 89

def raw_hash
  @raw_hash
end

Class Method Details

.from_hash(raw_hash) ⇒ Object



81
82
83
84
85
86
# File 'lib/teams.rb', line 81

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

.from_yml(config_yml) ⇒ Object



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

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?



116
117
118
119
120
121
122
# File 'lib/teams.rb', line 116

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

#hashObject

rubocop:disable Rails/Delegate



127
128
129
# File 'lib/teams.rb', line 127

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

#nameObject



106
107
108
# File 'lib/teams.rb', line 106

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

#to_tagObject



111
112
113
# File 'lib/teams.rb', line 111

def to_tag
  Teams.tag_value_for(name)
end