[Feature] `#unwrap_optional` helper
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start by locating RBS::Types::_TypeBase and RBS::Types::Optional, then read nearby type helpers and their tests if present. Add unwrap_optional so non-optional types return themselves while Optional returns its underlying type. Done means both behaviors are covered and the relevant test suite passes.
Written by the indexing model from the issue text.
Description
It's a really common operation to unwrap the optionality out of a type, e.g. turning String? into String.
I'd propose (in psuedocode):
interface RBS::Types::_TypeBase
# @overridable
#: -> _TypeBase
def unwrap_optional
self # not optional, nothing to unwrap.
end
end
class RBS::Types::Optional
# @override
#: -> _TypeBase
def unwrap_optional
type
end
end
- Dominant language
- Ruby
- Stars
- 2.2k
- Forks
- 256
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 37
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/rbs
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TheOdinProject/curriculum#31408 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Homebrew/homebrew-cask#288729 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100