tenderlove (owner)

Fork Of

Revisions

gist: 220300 Download_button fork
public
Public Clone URL: git://gist.github.com/220300.git
Embed All Files: show embed
README.md #

echo

Usage

require 'echo'

echo("foo msg") > "foofile"
echo("foo msg") >> "foofile"
echo.rb #
1
2
3
4
5
6
7
def echo msg
  Struct.new(:msg) {
    def method_missing sym, fname
      open(fname, sym == :> ? 'w' : 'a+') { |f| f.puts msg } || msg
    end
  }.new msg
end