Class: Smite::GodRank

Inherits:
Object
  • Object
show all
Defined in:
lib/smite/god_rank.rb

Instance Attribute Summary

Attributes inherited from Object

#data

Instance Method Summary collapse

Methods inherited from Object

#attributes, #method_missing

Constructor Details

#initialize(data) ⇒ GodRank

Returns a new instance of GodRank.



3
4
5
# File 'lib/smite/god_rank.rb', line 3

def initialize(data)
  super(DataTransform.transform_gods(data))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Smite::Object

Instance Method Details

#inspectObject



24
25
26
# File 'lib/smite/god_rank.rb', line 24

def inspect
  "#<Smite::GodRank '#{god.name}' Lvl. #{rank} (#{level})>"
end

#levelObject



7
8
9
10
11
12
13
14
# File 'lib/smite/god_rank.rb', line 7

def level
  case rank
  when 0      then  'none'
  when (1..4) then  'gold'
  when (5..9) then  'legendary'
  when 10     then  'diamond'
  end
end

#mastered?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/smite/god_rank.rb', line 20

def mastered?
  rank > 0
end

#masteryObject



16
17
18
# File 'lib/smite/god_rank.rb', line 16

def mastery
  mastered ? 'mastered' : 'unmastered'
end