class Dice::Roller
Attributes
count[R]
faces[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/dice/roller.rb, line 5 def initialize(args = {}) args = defaults.merge(args) @count = args[:count] @faces = args[:faces] end
Public Instance Methods
call()
click to toggle source
# File lib/dice/roller.rb, line 11 def call count.times do puts roll end end
defaults()
click to toggle source
# File lib/dice/roller.rb, line 21 def defaults { faces: 6, count: 1 } end
roll()
click to toggle source
# File lib/dice/roller.rb, line 17 def roll rand(1..faces) end