20 April 2008 and
In Smalltalk code and data are always kept together. In Ruby this isn’t the case. Manfred looks at a poor man’s version of keeping your data with your code.
20 April 2008 and
In Smalltalk code and data are always kept together. In Ruby this isn’t the case. Manfred looks at a poor man’s version of keeping your data with your code.
code = File.read($0).gsub(/\n^__END__.*$/m, '')
File.open($0, 'w') do |file|
file.write(code)
file.write("\n__END__\n")
file.write(Base64.encode64(Marshal.dump(data)))
end
end
Marshal.load(Base64.decode64(DATA.read)); rescue NameError
end
end
#!/usr/bin/env ruby
@lines = []
end
@lines << line
end
puts @lines.join("\n") unless @lines.empty?
end
end
if __FILE__ == $0
notes = Continue.defrost || Notes.new
if ARGV.empty?
notes.list
else
notes.add(ARGV.join(' '))
end
Continue.freeze(notes)
end