Sha256: 52ebbf4118d6362e93537b769eea9dea659ad68087c99f4f8fcc6a0b0907665e
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require "games_dice/version" begin require "games_dice/games_dice" rescue LoadError require "games_dice/probabilities" end require "games_dice/constants" require "games_dice/die" require "games_dice/die_result" require "games_dice/reroll_rule" require "games_dice/map_rule" require "games_dice/complex_die" require "games_dice/bunch" require "games_dice/dice" require "games_dice/parser" require "games_dice/marshal" 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 ) if prng parsed[:bunches].each { |bunch| bunch.merge!( :prng => prng ) } end GamesDice::Dice.new( parsed[:bunches], parsed[:offset] ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
games_dice-0.3.12 | lib/games_dice.rb |
games_dice-0.3.11 | lib/games_dice.rb |