class RSGuitarTech::SavedGame::Statistics::Song

Constants

ATTRIBUTES

Public Class Methods

from(key, json) click to toggle source
# File lib/rsgt/saved_game/statistics/song.rb, line 14
def self.from(key, json)
  sa_play_count = json["SAPlayCount"].map(&:values).flatten rescue []
  self.new(
    id:                        key,
    date_sa:                   json["DateSA"],
    sa_platinum_point_awarded: json["SAPlatinumPointAwarded"],
    mastery_last:              json["MasteryLast"],
    sa_play_count:             sa_play_count,
    played_count:              json["PlayedCount"],
    accuracy_global:           json["AccuracyGlobal"],
    date_las:                  json["DateLAS"],
    accuracy_chords:           json["AccuracyChords"],
    mastery_previous:          json["MasteryPrevious"],
    mastery_peak:              json["MasteryPeak"],
    mastery_previous_peak:     json["MasteryPreviousPeak"],
    streak:                    json["Streak"],
    sa_win_count:              json["SAWinCount"],
    sa_general_point_awarded:  json["SAGeneralPointAwarded"],
    articulation_accuracy:     json["ArticulationAccuracy"],
    chords_accuracies:         json["ChordsAccuracies"],
    sa_fail_count:             json["SAFailCount"],
    score_attack_play_count:   json["ScoreAttack_PlayCount"]
  )
end
new(args) click to toggle source
# File lib/rsgt/saved_game/statistics/song.rb, line 45
def initialize(args)
  args.each do |k, v|
    self.send("#{k}=", v)
  end
end
nil_song() click to toggle source
# File lib/rsgt/saved_game/statistics/song.rb, line 39
def self.nil_song
  self.new(
    ATTRIBUTES.inject({}) { |memo, attr| memo[attr] = nil; memo }
  )
end

Public Instance Methods

==(other) click to toggle source
# File lib/rsgt/saved_game/statistics/song.rb, line 51
def ==(other)
  return false if other == nil
  id == other.id
end