class SC2Race

Constants

RACES

Attributes

race[R]

Accessor and constants


Public Class Methods

new(race = 'terran', path = '/images/races/') click to toggle source

Constructor method


# File lib/sc2race.rb, line 19
def initialize(race = 'terran', path = '/images/races/')
  @race = RACES.include?(race) ? race : 'terran'
  @path = path
end

Public Instance Methods

to_s() click to toggle source

Public methods


# File lib/sc2race.rb, line 31
def to_s
  "#{@race}"
end
to_style() click to toggle source
# File lib/sc2race.rb, line 36
def to_style
  case @race
    when 'terran' then image_x = '-5px'; image_y = '-3px'
    when 'zerg' then image_x = '-5px'; image_y = '-60px'
    when 'protoss' then image_x = '-5px'; image_y = '-115px'
    when 'random' then image_x = '-5px'; image_y = '-168px'
    else image_x = '-5px'; image_y = '-3px'
  end
  
  "background: url('#{@path}race-symbols.png') #{image_x} #{image_y} no-repeat; width: 25px; height: 25px;"
end