lib/games_dice.rb in games_dice-0.2.1 vs lib/games_dice.rb in games_dice-0.2.2
- old
+ new
@@ -12,9 +12,14 @@
module GamesDice
# @!visibility private
@@parser = GamesDice::Parser.new
+ # Creates an instance of GamesDice::Dice from a string description.
+ # @param [String] dice_description Uses a variation of common game notation, examples: '1d6', '3d8+1d4+7', '5d10k2'
+ # @param [#rand] prng Optional random number generator, default is to use Ruby's built-in #rand()
+ # @return [GamesDice::Dice] A new dice object.
+ #
def self.create dice_description, prng = nil
parsed = @@parser.parse( dice_description )
GamesDice::Dice.new( parsed[:bunches], parsed[:offset], prng )
end
end