Title / Description
Code def save_preset t = Time.new file_name = sprintf("%04d-%02d-%02d_%02d%02d%02d", t.year, t.month, t.day, t.hour || 0, t.min || 0, t.sec || 0) File.open(File.join(preset_directory, file_name), "w") do |file| file.print YAML.dump [source_factories, @assigned_factories] end file_name end def next_preset directory = Dir.open(preset_directory) files = directory.entries[2..-1] @preset_index = @preset_index ? @preset_index + 1 : 0 @preset_index = 0 if @preset_index > files.length - 1 path = File.join(preset_directory, files[@preset_index]) source_factories, @assigned_factories = YAML.load_file(path) path end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code