Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move codes shared with Analyzer and Extractor to the module
- Loading branch information
Haruka Yoshihara
committed
Dec 18, 2012
1 parent
34df7e7
commit 74033bc
Showing
3 changed files
with
40 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env ruby | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License version 2.1 as published by the Free Software Foundation. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the Free Software | ||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
|
||
module Groonga | ||
module QueryLog | ||
module CommandLineUtils | ||
def log_via_stdin? | ||
input_with_pipe? or input_with_redirect? | ||
end | ||
|
||
def input_with_pipe? | ||
File.pipe?($stdin) | ||
end | ||
|
||
def input_with_redirect? | ||
not File.select([$stdin], [], [], 0).nil? | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters