Method: Jamf::Utility#stdin
- Defined in:
- lib/jamf/utility.rb
#stdin(line = 0) ⇒ String?
Retrive one or all lines from whatever was piped to standard input.
Standard input is read completely the first time this method is called and the lines are stored as an Array in the module var @stdin_lines
597 598 599 600 601 602 603 604 |
# File 'lib/jamf/utility.rb', line 597 def stdin(line = 0) @stdin_lines ||= ($stdin.tty? ? [] : $stdin.read.lines.map { |l| l.chomp("\n") }) return @stdin_lines.join("\n") if line <= 0 idx = line - 1 @stdin_lines[idx] end |