I have two variables which sometimes contain double data structure value. How can I determine in Ruby that a variable is having double value?
For example,
a = 3.4
a.is_a_double #=> true
a = "dadadad@asdasd.net"
a.is_a_double #=> false?
You should be able to use any of following method to know this:
See uses:
2.2.2 :009 > a = 4.5
=> 4.5
2.2.2 :010 > a.is_a? Float
=> true
2.2.2 :011 > a.kind_of? Float
=> true
2.2.2 :015 > a.instance_of? Float
=> true