You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are some methods I've personally added on projects before, I don't have time to PR them, but you might find these interesting ideas:
# Returns `value` if `value` is in the set or array# otherwise returns the `default` (which is nil unless provided)# These methods are useful for sanitizing input or expected valuesarray.permit(value,default)set.permit(value,default)# Opposite of Object#is_a?object.not_a?(klass)# Opposite of Object#nil?object.not_nil?# Like Time.parse and URI.parse, but returns nil instead of raising an exception# when the input is invalidTime.safe_parse(a_string)URI.safe_parse(a_string)# Like nil.to_i, but for BigDecimal# Returns a 0.0 BigDecimalnil.to_d# Applies Kernel.format to every value of the array using `format_string`array.format_all(format_string)
The text was updated successfully, but these errors were encountered:
These are some methods I've personally added on projects before, I don't have time to PR them, but you might find these interesting ideas:
The text was updated successfully, but these errors were encountered: