Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/pinzoro.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
override
12 13 14 15 16 17 18 19 |
# File 'lib/pinzoro.rb', line 12 def method_missing(name, *args) super if self <= 0 m = name.to_s.match(/\A[d|D](\d+)(!)?\z/) super unless m ret = self.diceroll(m[1].to_i) super unless ret m[2] ? ret.inject(&:+) : ret end |