Class: Smite::Player
Instance Attribute Summary collapse
Attributes inherited from Object
#data
Instance Method Summary
collapse
Methods inherited from Object
#attributes, #method_missing
Constructor Details
#initialize(player_name) ⇒ Player
Returns a new instance of Player.
5
6
7
8
|
# File 'lib/smite/player.rb', line 5
def initialize(player_name)
@player_name = player_name
super(Smite::Game.client.player(player_name)[0])
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Smite::Object
Instance Attribute Details
#player_name ⇒ Object
Returns the value of attribute player_name.
3
4
5
|
# File 'lib/smite/player.rb', line 3
def player_name
@player_name
end
|
Instance Method Details
#achievements ⇒ Object
32
33
34
35
36
37
|
# File 'lib/smite/player.rb', line 32
def achievements
return @achievements unless @achievements.nil?
achievements = Smite::Game.client.achievements(id)
@achievements = Achievements.new(achievements)
end
|
10
11
12
13
14
15
16
|
# File 'lib/smite/player.rb', line 10
def friends
return @friends unless @friends.nil?
@friends = Smite::Game.client.friends(player_name)
@friends = @friends.reject { |f| f['name'].empty? }
@friends.map!(&Friend.method(:new))
end
|
#god_ranks ⇒ Object
18
19
20
21
22
23
|
# File 'lib/smite/player.rb', line 18
def god_ranks
return @ranks unless @ranks.nil?
@ranks = Smite::Game.client.god_ranks(player_name)
@ranks.map!(&GodRank.method(:new))
end
|
39
40
41
|
# File 'lib/smite/player.rb', line 39
def inspect
"#<Smite::Player '#{name}'>"
end
|
#match_history ⇒ Object
25
26
27
28
29
30
|
# File 'lib/smite/player.rb', line 25
def match_history
return @history unless @history.nil?
@history = Smite::Game.client.match_history(player_name)
@history.map!(&RecentMatch.method(:new))
end
|