Class: Ruboty::Slot::SlotMachine

Inherits:
Object
  • Object
show all
Defined in:
lib/ruboty/slot/slot_machine.rb

Direct Known Subclasses

GumFruit

Instance Method Summary collapse

Instance Method Details

#pull_leverObject



10
11
12
# File 'lib/ruboty/slot/slot_machine.rb', line 10

def pull_lever
  reels.each(&:roll)
end

#push_stop_button(n) ⇒ Object



14
15
16
# File 'lib/ruboty/slot/slot_machine.rb', line 14

def push_stop_button(n)
  reels[n].stop
end

#reelsObject



6
7
8
# File 'lib/ruboty/slot/slot_machine.rb', line 6

def reels
  []
end

#to_sObject



18
19
20
21
# File 'lib/ruboty/slot/slot_machine.rb', line 18

def to_s
  first, *rest = reels.map(&:to_a)
  first.zip(*rest).map(&:join).join($/)
end