DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Nested Methods In Ruby
Source: <a href="http://twitter.com/igrigorik/status/11803597323">igrigorik</a> [twitter.com] ... ruby's syntax allows for nested methods:
def a; def b; :b; end; b; end; a #=> :b
Here's another example:
def a2 def c "hello" end c end a2 #=> "hello"
Note: Even though the method is nested it still has the same scope as a non-nested method.