Use kwargs for Rails::Components::BaseComponent#55
Use kwargs for Rails::Components::BaseComponent#55mvkampen wants to merge 1 commit intorubymonolith:mainfrom
Conversation
Keeping it uniform with Rails::Form. This gives more flexibility for arguments by default, while still allowing the attributes: keyword. Suports partial destructuring, thus preventing manual wrapping / unpacking of options. [rubymonolith#54]
|
Jus trying to imagine whether this is a breaking change. |
| delegate :dom, to: :field | ||
|
|
||
| def initialize(field, attributes: {}) | ||
| def initialize(field, **attributes) |
There was a problem hiding this comment.
Inheriting on this class will break
Could keep support and merge or choose
def initialize(field, attributes: {}, **kwargs)
@field = field
@attributes = attributes.merge(kwargs)
# or
@attributes = attributes.empty? kwargs : attributes
end
|
This would be a breaking change. The reason I made it a hash and not I could break it for the 0.6.x release. |
|
Found the reason I didn't pass The |
Keeping it uniform with Rails::Form. This gives more flexibility for arguments by default, while still allowing the attributes: keyword. Suports partial destructuring, thus preventing manual wrapping / unpacking of options.
[#54]