Skip to content

Commit

Permalink
Merge pull request fastruby#84 from jzakiya/master
Browse files Browse the repository at this point in the history
Add val.between?(start, end) to range comparisons
  • Loading branch information
etagwerker authored Nov 30, 2022
2 parents e7dcbe8 + 4af2bc5 commit 00f1df4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/range/cover-vs-include.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
x.report('range#include?') { (BEGIN_OF_JULY..END_OF_JULY).include? DAY_IN_JULY }
x.report('range#member?') { (BEGIN_OF_JULY..END_OF_JULY).member? DAY_IN_JULY }
x.report('plain compare') { BEGIN_OF_JULY < DAY_IN_JULY && DAY_IN_JULY < END_OF_JULY }

x.report('value.between?') { DAY_IN_JULY.between?(BEGIN_OF_JULY, END_OF_JULY) }

x.compare!
end

0 comments on commit 00f1df4

Please sign in to comment.