Class: ParaDice::NumberedDie

Inherits:
Object
  • Object
show all
Includes:
Die, Faces::Ranged
Defined in:
lib/para_dice/numbered_die.rb

Overview

a standard die like d6 d10, d20, d100 or exotic like d17, d32, d11-10, d100-999

Constant Summary

Constants included from Die

Die::ERROR_MSG

Instance Attribute Summary

Attributes included from Faces::Ranged

#range

Attributes included from Die

#description, #name, #rng

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Faces::Ranged

#face_count, #faces, #random_face

Methods included from Die

#face_count, #faces, #random_face, #roll

Constructor Details

#initialize(params = {}) ⇒ Object

initialize a new object, Inherited via Die from Virtus



# File 'lib/para_dice/numbered_die.rb', line 9

Class Method Details

.get(max) ⇒ Object

given a maximum value, return a NumberedDie with max faces from 1..max



15
16
17
# File 'lib/para_dice/numbered_die.rb', line 15

def self.get(max)
  self.new(name: "d#{max}", range: 1..max)
end