# File lib/uuid.rb, line 320 320: def next_sequence 321: if self.class.state_file 322: open_lock 'rb+' do |io| 323: @mac, @sequence, @last_clock = read_state(io) 324: 325: io.rewind 326: io.truncate 0 327: 328: @sequence += 1 329: 330: write_state io 331: end 332: else 333: @sequence += 1 334: end 335: rescue Errno::ENOENT 336: open_lock 'w' do |io| 337: write_state io 338: end 339: ensure 340: @last_clock = (Time.now.to_f * CLOCK_MULTIPLIER).to_i 341: @drift = 0 342: end