rbs
rbs copied to clipboard
inherit signature from another method
A pattern used a bit in the wild is the delegation of arguments to another method:
def perform(*args)
# log things, activate gear
do_perform(*args)
end
def do_perform(key, value, description)
....
Considering that add typing info to do_perform is straightforward, how could I hint in rbs that perform has the same signature? If not, does it make sense to have such a feature?
I believe tou can use alias perform do_perform
You can do that if they have exactly the same method types.
I know there are cases you want to add/remove arguments, but it cannot be done with RBS now. (You have to write two defs with the types (almost) duplicated.)