Sha256: 7ae0916ff972c1ed72b795918ce931cedd05ad3c678bc0291e109dcefb05f220
Contents?: true
Size: 312 Bytes
Versions: 1
Compression:
Stored size: 312 Bytes
Contents
module DMTool::Roller def self.roll(dice, directives) ret_val = dice.map do |die| directives.each_with_object(die) do |directive, ret| directive.process(ret) end end ret_val end def self.sum(dice, directives) roll(dice, directives).map(&:value).inject(0, :+) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dmtool-0.0.1 | lib/dmtool/roller.rb |