Class: Diaspora::Cluster::Creator::FateDice
- Inherits:
-
Object
- Object
- Diaspora::Cluster::Creator::FateDice
- Extended by:
- DependencyInjector
- Defined in:
- lib/diaspora-cluster-creator/fate_dice.rb
Instance Attribute Summary collapse
-
#dice_count ⇒ Object
Returns the value of attribute dice_count.
Instance Method Summary collapse
-
#initialize(dice_count = 4) ⇒ FateDice
constructor
A new instance of FateDice.
- #roll ⇒ Object
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_count ⇒ Object
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
#roll ⇒ Object
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 |