diff --git a/lib/structured_params/params.rb b/lib/structured_params/params.rb index 4c5c09e..1441a8f 100644 --- a/lib/structured_params/params.rb +++ b/lib/structured_params/params.rb @@ -73,10 +73,8 @@ def errors end # Convert structured objects to Hash and get attributes - #: (symbolize: true, compact: false) -> Hash[Symbol, untyped] - #: (symbolize: false, compact: false) -> Hash[String, untyped] - #: (symbolize: true, compact: true) -> Hash[Symbol, untyped] - #: (symbolize: false, compact: true) -> Hash[String, untyped] + #: (?symbolize: false, ?compact: bool) -> Hash[String, untyped] + #: (?symbolize: true, ?compact: bool) -> Hash[Symbol, untyped] def attributes(symbolize: false, compact: false) attrs = super() @@ -154,8 +152,7 @@ def format_error_path(attr_name, index = nil) end # Serialize structured values - #: (bool, compact: false) -> untyped - #: (bool, compact: true) -> untyped + #: (bool, ?compact: bool) -> untyped def serialize_structured_value(value, compact: false) case value when Array diff --git a/sig/structured_params/params.rbs b/sig/structured_params/params.rbs index 10239fa..5039774 100644 --- a/sig/structured_params/params.rbs +++ b/sig/structured_params/params.rbs @@ -38,14 +38,10 @@ module StructuredParams def errors: () -> ::StructuredParams::Errors # Convert structured objects to Hash and get attributes - # : (symbolize: true, compact: false) -> Hash[Symbol, untyped] - # : (symbolize: false, compact: false) -> Hash[String, untyped] - # : (symbolize: true, compact: true) -> Hash[Symbol, untyped] - # : (symbolize: false, compact: true) -> Hash[String, untyped] - def attributes: (symbolize: true, compact: false) -> Hash[Symbol, untyped] - | (symbolize: false, compact: false) -> Hash[String, untyped] - | (symbolize: true, compact: true) -> Hash[Symbol, untyped] - | (symbolize: false, compact: true) -> Hash[String, untyped] + # : (?symbolize: false, ?compact: bool) -> Hash[String, untyped] + # : (?symbolize: true, ?compact: bool) -> Hash[Symbol, untyped] + def attributes: (?symbolize: false, ?compact: bool) -> Hash[String, untyped] + | (?symbolize: true, ?compact: bool) -> Hash[Symbol, untyped] private @@ -74,10 +70,8 @@ module StructuredParams def format_error_path: (Symbol, Integer?) -> String # Serialize structured values - # : (bool, compact: false) -> untyped - # : (bool, compact: true) -> untyped - def serialize_structured_value: (bool, compact: false) -> untyped - | (bool, compact: true) -> untyped + # : (bool, ?compact: bool) -> untyped + def serialize_structured_value: (bool, ?compact: bool) -> untyped # Integrate structured parameter errors into parent errors # : (untyped, String) -> void