parlour
parlour copied to clipboard
Improved and enforced consistency between Namespace#create_x and X#initialize
It would be good to ensure that the signatures for Namespace#create_x
methods are the same as the signatures for the corresponding X#initialize
methods (besides the generator
parameter), improving the internal consistency of Parlour.
For example, the signature for Namespace#create_method
is:
def create_method(name, parameters: nil, return_type: nil, returns: nil, abstract: false, ...)
But the signature for Method#initialize
uses some positional arguments as keyword arguments instead:
def initialize(generator, name, parameters, return_type = nil, abstract: false, ...)
(This would have to be considered a breaking change.)
This consistency could also to enforced in tests by having a test which grabs method parameters and compares for each, adding a layer of protection against adding a parameter to one but not the other by accident.