From f83ded92545335bf72b895170f63a8d214ef2a93 Mon Sep 17 00:00:00 2001 From: Mahmut Bulut Date: Sun, 1 Apr 2012 21:02:39 +0300 Subject: [PATCH] is_integer? method declaration in prelude, generally wanted from developers --- golf_prelude.rb | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/golf_prelude.rb b/golf_prelude.rb index b090503..54e525f 100644 --- a/golf_prelude.rb +++ b/golf_prelude.rb @@ -84,6 +84,10 @@ def to_a split('') end + def is_integer? + self == self.to_i.to_s + end + (Array.instance_methods-instance_methods-[:to_ary,:transpose,:flatten,:flatten!,:compact,:compact!,:assoc,:rassoc]).each{|meth| eval" def #{meth}(*args, &block) -- 1.7.5.4