Class: SC2Race
- Inherits:
-
Object
- Object
- SC2Race
- Defined in:
- lib/sc2race.rb
Constant Summary collapse
- RACES =
["terran", "zerg", "protoss", "random"]
Instance Attribute Summary collapse
-
#race ⇒ Object
readonly
————————————————————————–.
Instance Method Summary collapse
-
#initialize(race = 'terran', path = '/images/races/') ⇒ SC2Race
constructor
————————————————————————–.
-
#to_s ⇒ Object
————————————————————————–.
- #to_style ⇒ Object
Constructor Details
Instance Attribute Details
#race ⇒ Object (readonly)
Accessor and constants
9 10 11 |
# File 'lib/sc2race.rb', line 9 def race @race end |
Instance Method Details
#to_s ⇒ Object
Public methods
31 32 33 |
# File 'lib/sc2race.rb', line 31 def to_s "#{@race}" end |
#to_style ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# 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 |