Class: SC2Cli::Subcommands::LadderShared::LadderDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/sc2cli/subcommands/ladder/ladderdetails.rb

Constant Summary collapse

@@console =
Shared::Console.instance
@@prefix =
"/sc2/profile"
@@suffix =
"/ladder"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, api:, player:) ⇒ LadderDetails

Returns a new instance of LadderDetails.



40
41
42
43
44
45
46
47
48
49
# File 'lib/sc2cli/subcommands/ladder/ladderdetails.rb', line 40

def initialize(id:, api:, player:)
  @@console.fatal("Cannot find ladder details for ladder with an ID that is not an integer!") unless id.kind_of?(Integer)
  @@console.fatal("Cannot find ladder details for ladder with an ID that is not valid!") unless id > 0

  @id     = id
  @player = player
  @region = api.region

  lookup(api: api)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



32
33
34
# File 'lib/sc2cli/subcommands/ladder/ladderdetails.rb', line 32

def id
  @id
end

#membershipObject (readonly)

Returns the value of attribute membership.



33
34
35
# File 'lib/sc2cli/subcommands/ladder/ladderdetails.rb', line 33

def membership
  @membership
end

#playerObject (readonly)

Returns the value of attribute player.



34
35
36
# File 'lib/sc2cli/subcommands/ladder/ladderdetails.rb', line 34

def player
  @player
end

#rankObject (readonly)

Returns the value of attribute rank.



35
36
37
# File 'lib/sc2cli/subcommands/ladder/ladderdetails.rb', line 35

def rank
  @rank
end

#regionObject (readonly)

Returns the value of attribute region.



36
37
38
# File 'lib/sc2cli/subcommands/ladder/ladderdetails.rb', line 36

def region
  @region
end

Instance Method Details

#to_sObject



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/sc2cli/subcommands/ladder/ladderdetails.rb', line 53

def to_s
  result = String.new

  result += "-------------------------------------------------------------------------------\n"
  result += @membership.to_s
  result += "-------------------------------------------------------------------------------\n"
  result += @teams.with_member(player: @player).to_s
  result += "Ranks/Pools for this player:\n"
  result += @rank.to_s

  return result
end