Module: Boneroller

Defined in:
lib/cinch/plugins/dice/boneroller.rb

Defined Under Namespace

Modules: Errors Classes: Dice

Constant Summary collapse

ATTACK_REGEXP =
/^(?:(\d+)#)?(\d+)?d(\d+|%)(\S+)?/
ELEMENTS_REGEXP =
/([+-\/*])(?:(\d+)?d(\d+)|(\d+))|(-[HL])/

Class Method Summary collapse

Class Method Details

.is_valid?(s) ⇒ Boolean

Returns:

  • (Boolean)

7
8
9
# File 'lib/cinch/plugins/dice/boneroller.rb', line 7

def is_valid?(s)
  !!s.match(ATTACK_REGEXP) 
end