Skip to content

Commit

Permalink
Implement StringIO encoding setter and getters
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Jul 27, 2012
1 parent e2a12ee commit 8d60875
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/19/stringio.rb
Expand Up @@ -53,6 +53,18 @@ def initialize_copy(from)
self
end

def set_encoding(external, internal=nil, options=nil)
@string.force_encoding(external || Encoding.default_external)
end

def external_encoding
@string.encoding
end

def internal_encoding
nil
end

def each_byte
return to_enum :each_byte unless block_given?
raise IOError, "not opened for reading" unless @readable
Expand Down

0 comments on commit 8d60875

Please sign in to comment.