Get class name from a class nested in a module in ruby -


if give you:

module   module somethingelse     class foo     end   end end 

how class name of "foo"? in console, have similar example, when .name on it doesn't print out expect.

this whats in console:

pry(main)> aisiswriter::controllers::commentsmanagement::commentshandler.name => "aisiswriter::controllers::commentsmanagement::commentshandler" 

what expect "commentshandler"

you can do:

aisiswriter::controllers::commentsmanagement::commentshandler.name.split('::').last || '' 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -