This doesn’t really make sense. The first part sounds like you request
nested functions (not methods!):
The second part sounds like you want methods to be objects and have
their own methods.
Nested functions can be achieved by using lambdas or procs. For the
second part I’d simply use private methods. Sure, they cannot be
restricted to a certain method. But that should never be a problem.
As Jan said, this doesn’t really fit the language. Methods have always
belonged to classes or modules, and now you request them to belong to
other methods instead. Lambdas will probably do the job just fine.
Also, it would break old code - for example currently Camping relies
on the way defining a method insde another method works.
– Matma R.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.