Skip to content

Commit

Permalink
Update {IO, ARGF}#{bytes, lines, chars} up to spec. See http://redmin…
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed May 3, 2010
1 parent 93f22c9 commit 4eaf895
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
2 changes: 1 addition & 1 deletion VERSION.yml
Expand Up @@ -2,4 +2,4 @@
:major: 1
:build:
:minor: 16
:patch: 6
:patch: 7
4 changes: 2 additions & 2 deletions backports.gemspec
Expand Up @@ -5,11 +5,11 @@

Gem::Specification.new do |s|
s.name = %q{backports}
s.version = "1.16.6"
s.version = "1.16.7"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Marc-Andr\303\251 Lafortune"]
s.date = %q{2010-04-16}
s.date = %q{2010-05-03}
s.description = %q{ Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.
}
s.email = %q{github@marc-andre.ca}
Expand Down
17 changes: 3 additions & 14 deletions lib/backports/1.8.7/argf.rb
Expand Up @@ -6,16 +6,6 @@ class << ARGF
end

class << ARGF
# No official documentation...
def bytes
to_enum :each_byte
end unless method_defined? :bytes

# No official documentation...
def chars
to_enum :each_char
end unless method_defined? :chars

# No official documentation...
def each_char
return to_enum(:each_char) unless block_given?
Expand Down Expand Up @@ -50,8 +40,7 @@ def each_char
# No official documentation...
Backports.alias_method self, :readbyte, :readchar

# No official documentation...
def lines(*args)
to_enum :each_line, *args
end unless method_defined? :lines
Backports.alias_method self, :bytes, :each_byte
Backports.alias_method self, :chars, :each_char
Backports.alias_method self, :lines, :each_line
end
20 changes: 4 additions & 16 deletions lib/backports/1.8.7/io.rb
Expand Up @@ -6,17 +6,6 @@ class << self
end
end

# Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/IO.html]
def bytes
to_enum :each_byte
end unless method_defined? :bytes

# Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/IO.html]
def chars
to_enum :each_char
end unless method_defined? :chars

# Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/IO.html]
def each_char
return to_enum(:each_char) unless block_given?
if $KCODE == "UTF-8"
Expand Down Expand Up @@ -44,12 +33,11 @@ def each_char
self
end unless method_defined? :each_char

Backports.alias_method self, :bytes, :each_byte
Backports.alias_method self, :chars, :each_char
Backports.alias_method self, :lines, :each_line

Backports.alias_method self, :getbyte, :getc
Backports.alias_method self, :readbyte, :readchar

# Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/IO.html]
def lines(*args)
to_enum :each_line, *args
end unless method_defined? :lines
end

0 comments on commit 4eaf895

Please sign in to comment.