Skip to content

Instantly share code, notes, and snippets.

@noqisofon
Created September 15, 2012 07:22
Show Gist options
  • Save noqisofon/3726757 to your computer and use it in GitHub Desktop.
Save noqisofon/3726757 to your computer and use it in GitHub Desktop.
File クラスに append っていうクラスメソッドを追加した感じ。
class File
def self.append(path, text)
File.open( path, "a" ) do |output|
output.puts text
end
end
end
if $0 == __FILE__ then
File.write "greeting.txt", "Hello, "
File.append "greeting.txt", "World!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment