Class: Stattleship::Models::Team

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/stattleship/models/team.rb

Instance Method Summary collapse

Instance Method Details

#color_cssObject



18
19
20
# File 'lib/stattleship/models/team.rb', line 18

def color_css
  "##{color}"
end

#colors_cssObject



22
23
24
25
26
# File 'lib/stattleship/models/team.rb', line 22

def colors_css
  if colors
    colors.map { |c| "##{c}"}
  end
end

#coordinatesObject



56
57
58
# File 'lib/stattleship/models/team.rb', line 56

def coordinates
  [latitude, longitude]
end

#dumpObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/stattleship/models/team.rb', line 38

def dump
  {
    full_name: full_name,
    title: title,
    color: color,
    colors: colors,
    hashtag: hashtag,
    hashtags: hashtags,
    league_abbreviation: league_abbreviation,
    location: location,
    latitude: latitude,
    longitude: longitude,
    name: name,
    nickname: nickname,
    slug: slug,
  }
end

#full_nameObject



4
5
6
# File 'lib/stattleship/models/team.rb', line 4

def full_name
  "#{location} #{nickname}"
end

#hashtag_with_hashObject



28
29
30
# File 'lib/stattleship/models/team.rb', line 28

def hashtag_with_hash
  "##{hashtag}"
end

#hashtags_with_hashObject



32
33
34
35
36
# File 'lib/stattleship/models/team.rb', line 32

def hashtags_with_hash
  if hashtags
    hashtags.map { |c| "##{c}"}
  end
end

#league_abbreviationObject



12
13
14
15
16
# File 'lib/stattleship/models/team.rb', line 12

def league_abbreviation
  if league
    league.abbreviation
  end
end

#titleObject



8
9
10
# File 'lib/stattleship/models/team.rb', line 8

def title
  "#{full_name} - #{league_abbreviation}"
end