- is_int? is rather misleading (I would not expect is_int?(1.2) to be true)
- Since Ruby ints are truthy, the idiomatic form would probably just return Integer(x) and false or nil otherwise:
def is_int?(x) Integer(x) rescue false end
- is_int? is rather misleading (I would not expect is_int?(1.2) to be true)
- Since Ruby ints are truthy, the idiomatic form would probably just return Integer(x) and false or nil otherwise: