Changeset [4250f5c437aeba209cd0dee2e16ff2c5009760a9] by Emmanuel Gomez

October 28th, 2011 @ 01:14 AM

Use Range#begin and #end instead of #min and #max.

Range gets #min and #max from Enumerable, which means it iterates to reach the endpoint values. Iterating instead of just querying for them is inefficient. Moreover, Ruby can't seem to iterate it's way to Infinity or -Infinity, which are valid Range endpoints (and which #begin and #end have no problem with).
https://github.com/datamapper/dm-validations/commit/4250f5c437aeba2...

Committed by Emmanuel Gomez

  • M lib/data_mapper/validation/rule/length/range.rb
  • M lib/data_mapper/validation/rule/within/range/bounded.rb
  • M lib/data_mapper/validation/rule/within/range/unbounded_end.rb
New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »