class Ruboty::Slot::Reel

Constants

DEFAULT_DISPLAY_SIZE

Public Class Methods

new(*symbols) click to toggle source
# File lib/ruboty/slot/reel.rb, line 9
def initialize(*symbols)
  @symbols = symbols
end

Public Instance Methods

default_display_size() click to toggle source
# File lib/ruboty/slot/reel.rb, line 13
def default_display_size
  DEFAULT_DISPLAY_SIZE
end
roll() click to toggle source
# File lib/ruboty/slot/reel.rb, line 17
def roll
  @rolled_count = SecureRandom.random_number(size)
  @stopped_at = nil
end
size() click to toggle source
# File lib/ruboty/slot/reel.rb, line 22
def size
  @symbols.size
end
stop(stopped_at = SecureRandom.random_number(size)) click to toggle source
# File lib/ruboty/slot/reel.rb, line 26
def stop(stopped_at  = SecureRandom.random_number(size))
  @stopped_at = stopped_at
end
to_a(size = default_display_size) click to toggle source
# File lib/ruboty/slot/reel.rb, line 30
def to_a(size = default_display_size)
  @symbols.lazy.cycle.drop(@rolled_count + @stopped_at).take(size).to_a
end