Created
September 15, 2012 07:22
-
-
Save noqisofon/3726757 to your computer and use it in GitHub Desktop.
File クラスに append っていうクラスメソッドを追加した感じ。
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
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