Module: YTools::Utils
- Defined in:
- lib/ytools/utils.rb
Class Method Summary collapse
Class Method Details
.print_example(basedir) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/ytools/utils.rb', line 6 def self.print_example(basedir) examples = File.join(basedir, 'examples.txt') File.open(examples, 'r') do |f| f.each_line do |line| puts line end end exit 0 end |
.stdin? ⇒ Boolean
16 17 18 19 20 21 22 23 |
# File 'lib/ytools/utils.rb', line 16 def self.stdin? begin require 'fcntl' STDIN.fcntl(Fcntl::F_GETFL, 0) == 0 && !$stdin.tty? rescue $stdin.stat.size != 0 end end |