Class: Range
Overview
Range
is extended with a few methods
Instance Method Summary collapse
-
#max_with_hornetseye ⇒ Object
For performance reasons a specialised method for integers is added.
-
#min_with_hornetseye ⇒ Object
For performance reasons a specialised method for integers is added.
-
#size ⇒ Integer
Compute the size of a range.
Instance Method Details
#max_with_hornetseye ⇒ Object
For performance reasons a specialised method for integers is added
421 422 423 424 425 426 427 |
# File 'lib/multiarray.rb', line 421 def max_with_hornetseye if self.end.is_a? Integer exclude_end? ? self.end - 1 : self.end else max_without_hornetseye end end |
#min_with_hornetseye ⇒ Object
For performance reasons a specialised method for integers is added
406 407 408 409 410 411 412 |
# File 'lib/multiarray.rb', line 406 def min_with_hornetseye if self.begin.is_a? Integer self.begin else min_without_hornetseye end end |
#size ⇒ Integer
Compute the size of a range
434 435 436 |
# File 'lib/multiarray.rb', line 434 def size max + 1 - min end |