-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add JSON additional signatures #597
Conversation
This change adds extended signatures (e.g. `#as_json` or `.json_create`) for JSON additional classes: - BigDecimal - Complex - DateTime - Date - Exception - OpenStruct - Range - Rational - Regexp - Set - Struct - Symbol - Time See <https://github.com/flori/json/blob/v2.5.1/lib/json/add/>
# Deserializes JSON string by constructing new Range object with arguments `a` | ||
# serialized by `to_json`. | ||
# | ||
def self.json_create: (Hash[String, String | [Elem, Elem, bool]] object) -> instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Goodcheck] Prefer
boolish
overbool
for method arguments and block return values (view)See the doc below:
https://github.com/ruby/rbs/blob/78d04a2db0f1c4925d2b13c2939868edf9465d6c/docs/syntax.md#bool-or-boolish
Rule rbs.prefer_boolish
You can close this issue if no need to fix it. Learn more.
Range#exclude_end?
returns bool
so I think bool
should be correct here. See below:
https://github.com/flori/json/blob/v2.5.1/lib/json/add/range.rb#L19
Line 125 in dcc5423
def `exclude_end?`: () -> bool |
# | ||
# method used for JSON marshalling support. | ||
# | ||
def as_json: (*untyped) -> Hash[String, String] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] Is there a better way than *untyped
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not very clear... *untyped
would be a good solution. 🙄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ybiquitous! Great effort! 💪
@soutaro Thank you so much for the review and merge! 😄 |
This change adds extended signatures (e.g.
#as_json
or.json_create
) for JSON additional classes:See https://github.com/flori/json/blob/v2.5.1/lib/json/add/
Related to #592