repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git]
/
lib
/
rexml
/
output.rb
blob
be4d23d42d96749d9b93b53e23057f99c10ea362
1
require 'rexml/encoding'
2
3
module REXML
4
class Output
5
include Encoding
6
7
attr_reader :encoding
8
9
def initialize real_IO, encd="iso-8859-1"
10
@output = real_IO
11
self.encoding = encd
12
13
@to_utf = encd == UTF_8 ? false : true
14
end
15
16
def <<( content )
17
@output << (@to_utf ? self.encode(content) : content)
18
end
19
20
def to_s
21
"Output[#{encoding}]"
22
end
23
end
24
end