Class Numeric
In: lib/rbot/core/utils/extends.rb
Parent: Object
User HTTPResponse BasicUserMessage Bot\n[lib/rbot/core/remote.rb\nlib/rbot/core/utils/extends.rb\nlib/rbot/core/utils/filters.rb\nlib/rbot/core/utils/wordlist.rb] HttpUtil Array Module Numeric Range String\n[lib/rbot/botuser.rb\nlib/rbot/core/utils/extends.rb\nlib/rbot/irc.rb\nlib/rbot/ircsocket.rb\nlib/rbot/load-gettext.rb] Regexp\n[lib/rbot/core/utils/extends.rb\nlib/rbot/irc.rb\nlib/rbot/messagemapper.rb] lib/rbot/core/userdata.rb lib/rbot/core/utils/httputil.rb lib/rbot/core/utils/extends.rb lib/rbot/core/remote.rb lib/rbot/core/utils/httputil.rb ParseTime Utils (null) dot/f_13.png

Extensions for the Numeric classes

Methods

clip  

Public Instance methods

This method forces a real number to be not more than a given positive number or not less than a given positive number, or between two any given numbers

[Source]

     # File lib/rbot/core/utils/extends.rb, line 195
195:   def clip(left,right=0)
196:     raise ArgumentError unless left.kind_of?(Numeric) and right.kind_of?(Numeric)
197:     l = [left,right].min
198:     u = [left,right].max
199:     return l if self < l
200:     return u if self > u
201:     return self
202:   end

[Validate]