Created
May 31, 2009 19:46
-
-
Save andreyvit/121003 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# min(alchogol to understand this func), vodka, cognac or “Gay Milker” kefir only | |
def apply_deletion range | |
return self if range.start >= self.end # -500 ml | |
len_diff = [self.length, range.length, self.end - range.start, range.end - self.start].min # 1000 ml | |
new_start = [range.start - [0, len_diff].min, self.start].min # 300 ml | |
TimeRange.new(new_start, new_start + self.length - [0, len_diff].max) # 700 ml | |
# total: 1500 ml | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment