Skip to content

Commit

Permalink
Fix an inner method Range#can_iterate_from?
Browse files Browse the repository at this point in the history
Prefer protected to private
--------------------------------------

* This method is just used by `self.each`.

Replace receiver for X19
------------------------

* `first` is gotten the `self.each`

refer
-----

  * rubinius#2272
  * rubinius#2272
  • Loading branch information
kachick committed Apr 12, 2013
1 parent 8a298a5 commit 52d471a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions kernel/common/range18.rb
Expand Up @@ -42,9 +42,8 @@ def each(&block)
alias_method :first, :begin
alias_method :last, :end

protected

def can_iterate_from?(object)
object.respond_to? :succ
end
private :can_iterate_from
end
5 changes: 2 additions & 3 deletions kernel/common/range19.rb
Expand Up @@ -80,9 +80,8 @@ def min(&block)
@begin
end

protected

def can_iterate_from?(object)
first.respond_to?(:succ) && !object.kind_of?(Time)
object.respond_to?(:succ) && !object.kind_of?(Time)
end
private :can_iterate_from
end

0 comments on commit 52d471a

Please sign in to comment.