lib/games_dice.rb in games_dice-0.0.5 vs lib/games_dice.rb in games_dice-0.0.6
- old
+ new
@@ -6,9 +6,15 @@
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"
module GamesDice
- # TODO: Factory methods for various dice schemes
+ @@parser = GamesDice::Parser.new
+
+ def self.create dice_description, prng = nil
+ parsed = @@parser.parse( dice_description )
+ GamesDice::Dice.new( parsed[:bunches], parsed[:offset], prng )
+ end
end