Class: Integer

Inherits:
Object
  • Object
show all
Defined in:
lib/rdgc/util/random_util.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



65
66
67
# File 'lib/rdgc/util/random_util.rb', line 65

def method_missing(name, *args)
  try_define_dice(name, args) ? (__send__ name) : super
end

Instance Method Details

#d10Object



77
78
79
# File 'lib/rdgc/util/random_util.rb', line 77

def d10
  self.dice(10)
end

#d4Object



69
70
71
# File 'lib/rdgc/util/random_util.rb', line 69

def d4
  self.dice(4)
end

#d6Object



73
74
75
# File 'lib/rdgc/util/random_util.rb', line 73

def d6
  self.dice(6)
end

#dice(max) ⇒ Object Also known as: d



60
61
62
# File 'lib/rdgc/util/random_util.rb', line 60

def dice(max)
  RDGC::Util::RandomUtil.dice(self, max)
end