Created
October 7, 2015 21:13
-
-
Save woods/fc7b4db9747d28b58a0e to your computer and use it in GitHub Desktop.
We don't need no stinkin' databases!
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
#!/usr/bin/env ruby | |
require 'yaml' | |
puts "How many sections?" | |
number_of_sections = Integer(gets) | |
data = YAML.load(DATA) | |
data['start'] = data['end'] + 1 | |
data['end'] += number_of_sections | |
File.open($0, 'r+') do |f| | |
loop do | |
break if f.gets =~ /^__END__/ | |
end | |
f.write(data.to_yaml) | |
end | |
__END__ | |
start: 124 | |
end: 127 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment