Skip to content

Improve documentation of Array#[Range]#10243

Merged
straight-shoota merged 11 commits intocrystal-lang:masterfrom
straight-shoota:docs/index-accessor-range
Jun 4, 2021
Merged

Improve documentation of Array#[Range]#10243
straight-shoota merged 11 commits intocrystal-lang:masterfrom
straight-shoota:docs/index-accessor-range

Conversation

@straight-shoota
Copy link
Member

Resolves #10222

This is only a draft for now, please review the wording for improvements.
I'll then copy appropriate documentation to String#[Range].

@HertzDevil
Copy link
Contributor

There are also Slice#[](Range) and BitArray#[](Range), by the way.

Co-authored-by: Quinton Miller <nicetas.c@gmail.com>
@straight-shoota
Copy link
Member Author

BitArray is a bit different, so that should be covered separately to get this merged.

@straight-shoota
Copy link
Member Author

@HertzDevil Looks like I had that already fixed but failed to push the changes. 🙈

src/string.cr Outdated
end

# Like `#[Range]`, but returns `nil` if the range's start is out of bounds.
# Like `#[Range]`, but returns `nil` if `range.begin` is out of range.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This #[Range] syntax is really confusing and it is not recognized by the doc generator.

#[](Range) would be recognized, though.
Same for #[](Int, Int).

I realize this is pre-existing, but on the other hand, this PR is about improving documentation.

@straight-shoota straight-shoota added this to the 1.1.0 milestone Jun 1, 2021
@straight-shoota straight-shoota merged commit 881eb81 into crystal-lang:master Jun 4, 2021
@straight-shoota straight-shoota deleted the docs/index-accessor-range branch June 4, 2021 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document Array#[] (range : Range) behavior with negative indices

4 participants