Method: String#>>

Defined in:
lib/chitin/core_ext/string.rb

#>>(other) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chitin/core_ext/string.rb', line 35

def >>(other)
  case other
  when Chitin::FileObject
    other.to_a.each do |fo|
      next if fo.directory?

      File.open(fo.to_s, 'a') {|f| f.puts self }
    end
  when String
    File.open(other, 'a') {|f| f.puts self }
  else
    raise "Unknown piping type: #{other.class}"
  end

  other
end