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
557 558 559 560 561 562 563 |
# File 'lib/multiarray.rb', line 557 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
542 543 544 545 546 547 548 |
# File 'lib/multiarray.rb', line 542 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
570 571 572 |
# File 'lib/multiarray.rb', line 570 def size max + 1 - min end |