Class: Osu::Score

Inherits:
Object
  • Object
show all
Defined in:
lib/osu/data.rb

Overview

A score, belonging to a user or beatmap

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Score

Returns a new instance of Score.


370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/osu/data.rb', line 370

def initialize(data)
  @beatmap_id = data['beatmap_id'].nil? ? nil : data['beatmap_id'].to_i

  @score = data['score'].to_i

  @username = data['username']

  @count300 = data['count300'].to_i

  @count100 = data['count100'].to_i

  @count50 = data['count50'].to_i

  @count_miss = data['countmiss'].to_i

  @max_combo = data['maxcombo'].to_i

  @count_katu = data['countkatu'].to_i

  @count_geki = data['countgeki'].to_i

  @perfect = data['perfect'].to_i == 1

  @mod_bits = data['enabled_mods'].to_i

  @user_id = data['user_id'].to_i

  @date = Time.parse data['date']

  @rank = data['rank']

  @pp = data['pp'].nil? ? nil : data['pp'].to_f

  @accuracy = ((@max_combo - @count_miss).to_f / @max_combo) * 100
end

Instance Attribute Details

#accuracyFloat (readonly)

Returns:

  • (Float)

368
369
370
# File 'lib/osu/data.rb', line 368

def accuracy
  @accuracy
end

#beatmap_idIntger (readonly)

Returns:

  • (Intger)

317
318
319
# File 'lib/osu/data.rb', line 317

def beatmap_id
  @beatmap_id
end

#count100Integer (readonly)

Returns:

  • (Integer)

329
330
331
# File 'lib/osu/data.rb', line 329

def count100
  @count100
end

#count300Integer (readonly)

Returns:

  • (Integer)

326
327
328
# File 'lib/osu/data.rb', line 326

def count300
  @count300
end

#count50Integer (readonly)

Returns:

  • (Integer)

332
333
334
# File 'lib/osu/data.rb', line 332

def count50
  @count50
end

#count_gekiInteger (readonly) Also known as: geki

Returns:

  • (Integer)

345
346
347
# File 'lib/osu/data.rb', line 345

def count_geki
  @count_geki
end

#count_katuInteger (readonly) Also known as: katu

Returns:

  • (Integer)

341
342
343
# File 'lib/osu/data.rb', line 341

def count_katu
  @count_katu
end

#count_missInteger (readonly)

Returns:

  • (Integer)

335
336
337
# File 'lib/osu/data.rb', line 335

def count_miss
  @count_miss
end

#dateTime (readonly)

Returns:

  • (Time)

359
360
361
# File 'lib/osu/data.rb', line 359

def date
  @date
end

#max_comboInteger (readonly)

Returns:

  • (Integer)

338
339
340
# File 'lib/osu/data.rb', line 338

def max_combo
  @max_combo
end

#mods_bitsInteger (readonly)

Returns:

  • (Integer)

353
354
355
# File 'lib/osu/data.rb', line 353

def mods_bits
  @mods_bits
end

#perfecttrue, false (readonly) Also known as: perfect?

Returns:

  • (true, false)

349
350
351
# File 'lib/osu/data.rb', line 349

def perfect
  @perfect
end

#ppFloat (readonly)

Returns:

  • (Float)

365
366
367
# File 'lib/osu/data.rb', line 365

def pp
  @pp
end

#rankString (readonly)

Returns:

  • (String)

362
363
364
# File 'lib/osu/data.rb', line 362

def rank
  @rank
end

#scoreInteger (readonly)

Returns:

  • (Integer)

320
321
322
# File 'lib/osu/data.rb', line 320

def score
  @score
end

#user_idInteger (readonly)

Returns:

  • (Integer)

356
357
358
# File 'lib/osu/data.rb', line 356

def user_id
  @user_id
end

#usernameString (readonly)

Returns:

  • (String)

323
324
325
# File 'lib/osu/data.rb', line 323

def username
  @username
end

Instance Method Details

#mods(stringify = false) ⇒ Array<Symbol>, Array<String>

Get an array of symbols or strings as to what mods this score has enabled

Returns:

  • (Array<Symbol>, Array<String>)

410
411
412
# File 'lib/osu/data.rb', line 410

def mods(stringify = false)
  API::Mods.mods @mod_bits, stringify
end