Class: Text::Gen::Segment::Dice
- Inherits:
-
Object
- Object
- Text::Gen::Segment::Dice
- Defined in:
- lib/text/gen/segment/dice.rb
Constant Summary collapse
- DICE_MATCHER =
/\[\s*(\d*[dD]\d+(?:\s*[+x-]\s*\d+)?)\s*\]/
Class Method Summary collapse
Class Method Details
.scan(scanner) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/text/gen/segment/dice.rb', line 9 def scan(scanner) str = scanner.scan(DICE_MATCHER) return unless str { "type" => "dice", "text" => scanner[1] } end |