Sha256: a35daff2b34609ac5081c7b70bc275e3ff3681cc5ddee932e92aef8091fa2f86
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true 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) parsed[:bunches].each { |bunch| bunch.merge!(prng: prng) } if prng GamesDice::Dice.new(parsed[:bunches], parsed[:offset]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
games_dice-0.4.0 | lib/games_dice.rb |