Class: Cliptic::Main::Player::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/cliptic/main.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time: 0, bar:, callback:) ⇒ Timer

Returns a new instance of Timer.



721
722
723
724
# File 'lib/cliptic/main.rb', line 721

def initialize(time:0, bar:, callback:)
  @time = Time.abs(time)
  @bar, @callback = bar, callback
end

Instance Attribute Details

#barObject (readonly)

Returns the value of attribute bar.



720
721
722
# File 'lib/cliptic/main.rb', line 720

def bar
  @bar
end

#callbackObject (readonly)

Returns the value of attribute callback.



720
721
722
# File 'lib/cliptic/main.rb', line 720

def callback
  @callback
end

#runObject (readonly)

Returns the value of attribute run.



720
721
722
# File 'lib/cliptic/main.rb', line 720

def run
  @run
end

#timeObject (readonly)

Returns the value of attribute time.



720
721
722
# File 'lib/cliptic/main.rb', line 720

def time
  @time
end

Instance Method Details

#resetObject



732
733
734
735
# File 'lib/cliptic/main.rb', line 732

def reset
  @time = Time.abs(0)
  @run = false
end

#startObject



725
726
727
728
# File 'lib/cliptic/main.rb', line 725

def start
  Thread.new{tick}
  @run = true
end

#stopObject



729
730
731
# File 'lib/cliptic/main.rb', line 729

def stop
  @run = false
end