I have a following lines in my ruby script. It gives the output as main
when i run this script. But i cannot access that main
. I don't know what is this?
Is an object or instance?
For example :
puts self #=> main
If i access the "main" means it gives the error like "undefined local variable or method".
Previously i use this self to print its current object within a class. For example:
class Ex
puts self #=> Ex
end
Here, i can use that self object to get the current class name. After
this i can able to access that Ex
class. But in first example it
returns main
. But i can't access that. So what is a reason
behind this?