Class: Assist::Player

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/Assist/player.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Player) initialize(username)

A new instance of Player



13
14
15
# File 'lib/Assist/player.rb', line 13

def initialize(username)
  self.username = username
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

- (Object) method_missing(name, *args, &block)



9
10
11
# File 'lib/Assist/player.rb', line 9

def method_missing(name, *args, &block)
  profile.fetch(name.to_s) { super }
end

Instance Attribute Details

- (Object) username

Returns the value of attribute username



4
5
6
# File 'lib/Assist/player.rb', line 4

def username
  @username
end

Instance Method Details

- (Object) profile(force = false)



17
18
19
# File 'lib/Assist/player.rb', line 17

def profile(force= false)
  force ? @profile = get_profile : @profile ||= get_profile
end

- (Object) shots(force = false)



25
26
27
# File 'lib/Assist/player.rb', line 25

def shots(force= false)
  force ? @shots = get_player_shots : @shots ||= get_player_shots
end