Class: StudioGameJB::Dice

Inherits:
Object
  • Object
show all
Includes:
Auditable
Defined in:
lib/studio_game_jb/dice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Auditable

#audit

Constructor Details

#initializeDice

Returns a new instance of Dice.



9
10
11
# File 'lib/studio_game_jb/dice.rb', line 9

def initialize
  roll
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



7
8
9
# File 'lib/studio_game_jb/dice.rb', line 7

def number
  @number
end

Instance Method Details

#rollObject



13
14
15
16
17
# File 'lib/studio_game_jb/dice.rb', line 13

def roll
  @number = rand 1..6
  audit
  @number
end