Module: Rake::ToolkitProgram::RangeConversion
- Defined in:
- lib/rake/toolkit_program/utils.rb
Instance Method Summary collapse
-
#to_inclusive ⇒ Object
Return a Range the includes the end.
Instance Method Details
#to_inclusive ⇒ Object
Return a Range the includes the end
This method will error if the subject Range excludes the end but the bounds are not Integers.
29 30 31 32 33 |
# File 'lib/rake/toolkit_program/utils.rb', line 29 def to_inclusive return self unless exclude_end? raise "only Integer Ranges can be converted" if [self.begin, self.end].any? {|v| !(Integer === v)} return (self.begin..(self.end - 1)) end |