lib/tabs/helpers.rb in tabs-0.8.1 vs lib/tabs/helpers.rb in tabs-0.8.2
- old
+ new
@@ -16,7 +16,12 @@
def normalize_period(period, resolution)
period_start = Tabs::Resolution.normalize(resolution, period.first.utc)
period_end = Tabs::Resolution.normalize(resolution, period.last.utc)
(period_start..period_end)
end
+
+ def to_numeric(v)
+ ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v
+ end
+
end
end