From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.4 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 10CA563381C for ; Sun, 5 Jul 2015 03:10:42 +0000 (UTC) Received: from localhost ([::1]:45685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBaKH-0006Ri-BP for dtas-all@80x24.org; Sat, 04 Jul 2015 23:10:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBaKE-0006Rc-9p for dtas-all@nongnu.org; Sat, 04 Jul 2015 23:10:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZBaK4-0004Ab-1Q for dtas-all@nongnu.org; Sat, 04 Jul 2015 23:10:38 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:60996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZBaK3-00049S-RX for dtas-all@nongnu.org; Sat, 04 Jul 2015 23:10:27 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CB66963381C for ; Sun, 5 Jul 2015 03:10:25 +0000 (UTC) From: Eric Wong To: Subject: [PATCH] parse_time: pass through numeric types Date: Sun, 5 Jul 2015 03:10:25 +0000 Message-Id: <1436065825-5332-1-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.3.1.168.g3dc290c X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org This makes it easier to use in a user-friendly scripting interface we have coming up. --- lib/dtas/parse_time.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dtas/parse_time.rb b/lib/dtas/parse_time.rb index 7dd41c6..473f412 100644 --- a/lib/dtas/parse_time.rb +++ b/lib/dtas/parse_time.rb @@ -3,9 +3,11 @@ require_relative '../dtas' module DTAS::ParseTime - # convert a string time to seconds, returning a Flot or Integer + # convert a string time to seconds, returning a Floot or Integer def parse_time(time) case time + when Numeric + time when /\A\d+\z/ time.to_i when /\A[\d\.]+\z/ -- 2.3.1.168.g3dc290c