Sha256: a02b9dcecd95d6f2008f8b3ef709a7c0aa2796acbf08d5f43ce48eaa162533c8
Contents?: true
Size: 705 Bytes
Versions: 1
Compression:
Stored size: 705 Bytes
Contents
module Dicechucker class Diesheet attr_accessor :diesets def initialize(diesets = {}) @diesets = {} diesets.each do |key, value| @diesets[key] = Dicechucker.parse(value) end end def [](key) @diesets[key] end def add(key, dieset) @diesets[key] = Dicechucker.parse(dieset) end def remove(key) @diesets.delete(key) end def roll @diesets.each_value do |value| value.roll end end def results to_s end def to_s output = "" @diesets.each do |key, value| output << "#{key.to_s} = #{value.total.to_s}\n" end output end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dicechucker-0.8.0 | lib/dicechucker/diesheet.rb |