Class: Diaspora::Cluster::Creator::FateDice

Inherits:
Object
  • Object
show all
Extended by:
DependencyInjector
Defined in:
lib/diaspora-cluster-creator/fate_dice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dice_count = 4) ⇒ FateDice

Returns a new instance of FateDice.



11
12
13
# File 'lib/diaspora-cluster-creator/fate_dice.rb', line 11

def initialize(dice_count = 4)
  self.dice_count = dice_count
end

Instance Attribute Details

#dice_countObject

Returns the value of attribute dice_count.



10
11
12
# File 'lib/diaspora-cluster-creator/fate_dice.rb', line 10

def dice_count
  @dice_count
end

Instance Method Details

#rollObject



15
16
17
# File 'lib/diaspora-cluster-creator/fate_dice.rb', line 15

def roll
  (1..dice_count).inject(0) {|m,v| m += randomizer.call }
end