Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4609

Passing boolean parameter in ruby

$
0
0

I am wondering how do I pass a false value to my ruby script.

If I invoke:

ruby myscript.rb false

and then in my script if I say:

my_class.new(*ARGV)or my_class.new(ARGV[0])

basically a string with value "false" gets passed. Clearly if I say

if(ARGV[0]){ do something} .. this gets executed even if value passed is false. 

Can I change my function signature to auto-covert paramter to boolean ..so that I dont have to do

if(ARGV[0]=='true')

Viewing all articles
Browse latest Browse all 4609

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>