From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 2/3] parse_time: pass through floats and integers
Date: Sun, 5 Jul 2015 02:21:16 +0000 [thread overview]
Message-ID: <1436062877-12475-2-git-send-email-e@80x24.org> (raw)
In-Reply-To: <1436062877-12475-1-git-send-email-e@80x24.org>
This makes it easier to use in a user-friendly scripting interface
---
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..aa4ac0d 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 Float, Integer
+ time
when /\A\d+\z/
time.to_i
when /\A[\d\.]+\z/
--
EW
next prev parent reply other threads:[~2015-07-05 2:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-05 2:21 [PATCH 1/3] introduce epoch for scheduling tfx bits Eric Wong
2015-07-05 2:21 ` Eric Wong [this message]
2015-07-05 2:21 ` [PATCH 3/3] huge revamp Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436062877-12475-2-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).