Ruby / Rails alternative to PHP print_r() and var_dump()
Both PHP functions provides information about a variable passed as argument. It is often used in development to get quick and human-readable info about array or object. If you are using Rails you can use DebugHelper’s debug(object) helper function. Note that helpers are available only in views. In controllers, models and other Ruby code you can use ‘puts YAML::dump(object)’ method to get readable info about object.
I am Bojan Mihelac and this blog is dedicated to share code, thoughts, tools and advices I came up with while working in
9 comments
isset($_GET['param']), can be written asparams.include?("confirm").isset(var1)can be written as:defined? var1Does ruby(without rails) have any similar function?
Speak your mind: