Skip to content

Commit f8c2651

Browse files
committed
Merge pull request dcparker#70 from Hiroyama-Yutaka/master
support one-day input by ‘:after’ & ‘:before’
2 parents d42558d + 8d4fcf2 commit f8c2651

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/gmail/mailbox.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ def emails(key_or_opts = :all, opts={})
4343
raise ArgumentError, "Couldn't make sense of arguments to #emails - should be an optional hash of options preceded by an optional read-status bit; OR simply an array of parameters to pass directly to the IMAP uid_search call."
4444
end
4545
if !opts.empty?
46+
47+
if opts[:after] === opts[:before]
48+
opts[:on] = opts[:before]
49+
opts[:after] = nil
50+
opts[:before] = nil
51+
end
52+
4653
# Support for several search macros
4754
# :before => Date, :on => Date, :since => Date, :from => String, :to => String
4855
search.concat ['SINCE', opts[:after].to_imap_date] if opts[:after]

0 commit comments

Comments
 (0)