Project

General

Profile

Actions

Bug #5656

closed

Improve documentation for Range

Added by zetter (Chris Zetter) about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0dev (2011-11-21 trunk 33804)
Backport:
[ruby-core:41182]

Description

I've tried to improve the documentation for range by:

  • adding more examples
  • simplifying existing examples
  • moving case statement example to top level documentation
  • adding and fixing links to methods
  • using consistent terminology and formatting of and parameters and variables
  • clarifying edge cases of methods
  • better explaining of when the succ method is needed

I also wanted to group the '===' operator with 'include?' and 'member?' methods
in the docs. I put this in a seperate patch since it requires code changes.


Files

Actions #1

Updated by drbrain (Eric Hodel) almost 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r33958.
Chris, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • range.c: Improve documentation for Range. Patch by Chris Zetter.
    [Ruby 1.9 - Bug #5656]

Updated by drbrain (Eric Hodel) almost 13 years ago

=begin
I restored the Xs example in #step since it seemed more illustrative.

I restored the === comment to the === documentation since it isn't something special to Range, all objects can behave that way.

Your second patch cannot be applied because it changes the behavior of Range:

class X < Range

def include? other
  false
end

end

r = Range.new 5, 10
x = X.new 5, 10

p r === 6
p x === 6

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0