Class: Songfile::Die

Inherits:
Object
  • Object
show all
Defined in:
lib/songfile/die.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDie

Returns a new instance of Die.



9
10
11
# File 'lib/songfile/die.rb', line 9

def initialize
    roll #the new die object now initializes as soon as "roll" is called anywhere.
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



3
4
5
# File 'lib/songfile/die.rb', line 3

def number
  @number
end

Instance Method Details

#rollObject



5
6
7
# File 'lib/songfile/die.rb', line 5

def roll
    @number = rand(1..6)
end