Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/splits-io. a speedrunning data store and analysis engine splits.io
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152class Split < ActiveRecord::Base attr_accessor :name, :duration, :finish_time, :best, :history, :gold, :skipped, :reduced
def initialize(h = {}) @name = h[:name] @duration = h[:duration] @finish_time = h[:finish_time] @best = h[:best] @history = h[:history] @gold = h[:gold?] || h[:gold] @skipped = h[:skipped?] || h[:skipped] @reduced = h[:reduced?] || h[:reduced] end
def gold? gold end
def skipped? skipped end
def reduced? reduced end
def to_h { name: name, duration: duration, finish_time: finish_time, best: best, gold?: gold, skipped?: skipped, reduced?: reduced, history: history }.compact end
def serializable_hash { name: name, duration: duration, finish_time: finish_time, best: best.try(:serializable_hash), gold?: gold, skipped?: skipped, history: history }.compact endend