Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f19819bbdba8
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4dd5076e0b6d
Choose a head ref
  • 4 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 28, 2016

  1. clarify intent of spec

    chuckremes committed Jun 28, 2016
    Copy the full SHA
    f11426b View commit details

Commits on Jun 30, 2016

  1. Copy the full SHA
    f2f34d5 View commit details

Commits on Jul 6, 2016

  1. Revert "stub in attempt at accessing transcoders"

    This reverts commit 6455dc7.
    chuckremes committed Jul 6, 2016
    Copy the full SHA
    72ece66 View commit details
  2. Copy the full SHA
    4dd5076 View commit details
Showing with 5 additions and 23 deletions.
  1. +1 −10 core/encoding.rb
  2. +3 −12 core/string.rb
  3. +1 −1 spec/ruby/core/io/popen_spec.rb
11 changes: 1 addition & 10 deletions core/encoding.rb
Original file line number Diff line number Diff line change
@@ -129,15 +129,6 @@ def initialize(from, to, options=undefined)

unless source_name == dest_name
@convpath, @converters = TranscodingPath[source_name, dest_name]
else
# they are the same encoding so let's check for newline transcoding and override it
if new_to = options[:newline] || options[:universal_newline] || options[:cr_newline] || options[:crlf_newline]
new_to = "#{new_to}_newline" if [:cr, :crlf, :universal].include?(new_to)

@source_encoding = Rubinius::Type.coerce_to_encoding(from)
@destination_encoding = Rubinius::Type.coerce_to_encoding(new_to)
@convpath, @converters = TranscodingPath[@source_encoding.name.upcase.to_sym, @destination_encoding.name.to_sym]
end
end

unless @convpath
@@ -574,7 +565,7 @@ def self.find(name)
enc = Rubinius::Type.try_convert_to_encoding name
return enc unless undefined.equal? enc

raise ArgumentError, "unknown encoding name - #{name}, list #{list.inspect}"
raise ArgumentError, "unknown encoding name - #{name}"
end

def self.list
15 changes: 3 additions & 12 deletions core/string.rb
Original file line number Diff line number Diff line change
@@ -1122,18 +1122,9 @@ def encode!(to=undefined, from=undefined, options=undefined)
raise ArgumentError, "unexpected value for xml option: #{xml.inspect}"
end

if new_to = options[:universal_newline] || options[:crlf_newline] || options[:cr_newline] || options[:newline]
STDERR.puts "String.encode!, new_to #{new_to.inspect}, from_enc #{from_enc.inspect}, to_enc #{to_enc.inspect}"
#raise ArgumentError, "unexpected value, from: #{from_enc.inspect}, to: #{to_enc.inspect}, options: #{options.inspect}"
ec = Encoding::Converter.new(from_enc, (to_enc || from_enc), options)
dest = ""
status = ec.primitive_convert self.dup, dest, nil, nil, ec.options
raise ec.last_error unless status == :finished
replace dest
end
# if options[:universal_newline]
# gsub!(/\r\n|\r/, "\r\n" => "\n", "\r" => "\n")
# end
if options[:universal_newline]
gsub!(/\r\n|\r/, "\r\n" => "\n", "\r" => "\n")
end
end

self
2 changes: 1 addition & 1 deletion spec/ruby/core/io/popen_spec.rb
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
lambda { @io.write('foo') }.should raise_error(IOError)
end

it "forces an infinitely looping subprocess to close" do
it "sees an infinitely looping subprocess exit when read pipe is closed" do
io = IO.popen "#{RUBY_EXE} -e 'r = loop{puts \"y\"; 0} rescue 1; exit r'", 'r'
io.close