Skip to content
Permalink
Browse files
fix merge problem handling eof in #each
  • Loading branch information
chuckremes committed Jan 9, 2016
2 parents f813c6c + 850dad7 commit 82fb8c8cdc40bfb6943b2d779de12830c42bc165
Showing with 49 additions and 13 deletions.
  1. +13 −8 README
  2. +6 −1 README.md
  3. +3 −1 kernel/common/enumerable.rb
  4. +3 −2 kernel/common/io.rb
  5. +5 −0 spec/ruby/core/enumerable/first_spec.rb
  6. +10 −1 spec/ruby/core/io/puts_spec.rb
  7. +9 −0 spec/ruby/core/io/shared/each.rb
21 README
@@ -11,10 +11,15 @@ Rubinius runs on Mac OS X and many Unix/Linux operating systems. Microsoft
Windows is not yet supported.


2. The Ruby Programming Language
2. Code of Conduct

Participation in the Rubinius project is governed by the Rubinius Code of
Conduct. See http://rubinius.com/code-of-conduct/

3. The Ruby Programming Language

Many popular Ruby applications, like Rails, run on Rubinius, which aims to be
compatible with Ruby version 2.1.
compatible with Ruby version 2.2.

Rubinius includes a Ruby parser, Ruby bytecode compiler, Ruby core library,
and C-API compatibility for native C extensions. The Ruby core library is
@@ -33,13 +38,13 @@ The following Ruby features are not supported on Rubinius:
* $SAFE levels


3. License
4. License

Rubinius uses the MPL-2.0 license. See LICENSE for details. Contributions made
prior to January 3rd, 2016 are licensed under the old BSD 3-clause license. A
copy of this license can be found in the file "BSD_LICENSE".

4. Installing Rubinius from Source
5. Installing Rubinius from Source

To install Rubinius, use the following steps:

@@ -56,21 +61,21 @@ information see http://rubinius.com/doc/en/getting-started/requirements/
and http://rubinius.com/doc/en/getting-started/building/.


5. Using RubyGems
6. Using RubyGems

Rubinius comes with RubyGems built-in. To install a gem, run the following:

$ rbx -S gem install <gem_name>


6. Documentation
7. Documentation

The Rubinius documentation is available at the Rubinius website:

http://rubinius.com


7. Issues & Support
8. Issues & Support

Please file tickets for bugs or problems. The issue tracker is:

@@ -81,7 +86,7 @@ For additional help, visit the Rubinius Gitter chat room:
https://gitter.im/rubinius/rubinius


8. Contributing
9. Contributing

The Rubinius team welcomes contributions. For more information, read the
CONTRIBUTING file in the root directory of Rubinius.
@@ -9,10 +9,15 @@ Rubinius includes a bytecode virtual machine, generational garbage collector, an
Rubinius runs on Mac OS X and many Unix/Linux operating systems. Microsoft Windows is not yet supported.


### Code of Conduct

Participation in the Rubinius project is governed by the Rubinius [Code of
Conduct](http://rubinius.com/code-of-conduct/).

### The Ruby Programming Language

Many popular Ruby applications, like Rails, run on Rubinius, which aims to be
compatible with Ruby version 2.1.
compatible with Ruby version 2.2.

Rubinius includes a Ruby parser, Ruby bytecode compiler, Ruby core library,
and C-API compatibility for native C extensions. The Ruby core library is
@@ -563,7 +563,9 @@ def find_index(value=undefined)

def first(n=undefined)
return __take__(n) unless undefined.equal?(n)
each { |element| return element }
each do
return Rubinius.single_block_arg
end
nil
end

@@ -2170,6 +2170,7 @@ def each(sep_or_limit=$/, limit=nil, &block)
end
end

raise ArgumentError, "limit of 0 is invalid" if limit && limit.zero?
return if eof?

EachReader.new(self, sep, limit).each(&block)
@@ -2596,9 +2597,9 @@ def puts(*args)
str = ""
elsif Thread.guarding? arg
str = "[...]"
elsif arg.kind_of?(Array)
elsif arg.respond_to?(:to_ary)
Thread.recursion_guard arg do
arg.each do |a|
arg.to_ary.each do |a|
puts a
end
end
@@ -12,6 +12,11 @@
EnumerableSpecs::Empty.new.first.should == nil
end

it 'returns a gathered array from yield parameters' do
EnumerableSpecs::YieldsMulti.new.to_enum.first.should == [1, 2]
EnumerableSpecs::YieldsMixed2.new.to_enum.first.should == nil
end

it "raises a RangeError when passed a Bignum" do
enum = EnumerableSpecs::Empty.new
lambda { enum.first(bignum_value) }.should raise_error(RangeError)
@@ -37,7 +37,16 @@
@io.puts(nil, nil).should == nil
end

it "calls to_s before writing non-string objects" do
it "calls to_ary before writing non-string objects that respond to :to_ary" do
object = mock('hola')
object.should_receive(:to_ary).and_return(["hola"])

@io.should_receive(:write).with("hola")
@io.should_receive(:write).with("\n")
@io.puts(object).should == nil
end

it "calls to_s before writing non-string objects that don't respond to :to_ary" do
object = mock('hola')
object.should_receive(:to_s).and_return("hola")

@@ -73,6 +73,15 @@
end
end

describe "with limit" do
describe "when limit is 0" do
it "raises an ArgumentError" do
# must pass block so Enumerator is evaluated and raises
lambda { @io.send(@method, 0){} }.should raise_error(ArgumentError)
end
end
end

describe "when passed a String containing one space as a separator" do
it "uses the passed argument as the line separator" do
@io.send(@method, " ") { |s| ScratchPad << s }

0 comments on commit 82fb8c8

Please sign in to comment.