Class: Ukiryu::Pipe
- Inherits:
-
Object
- Object
- Ukiryu::Pipe
- Defined in:
- lib/ukiryu/io.rb
Overview
Pipe redirection for inter-process communication
Pipes allow the output of one command to become the input of another. This is represented by special file path markers.
Constant Summary collapse
- MARKER =
Special marker for pipe output
'%pipe%'
Class Method Summary collapse
-
.parse(value) ⇒ String?
Parse a pipe marker.
-
.pipe?(value) ⇒ Boolean
Check if a value is a pipe marker.
-
.to(command) ⇒ String
Create a pipe to a command.
Class Method Details
.parse(value) ⇒ String?
Parse a pipe marker
89 90 91 92 93 94 |
# File 'lib/ukiryu/io.rb', line 89 def self.parse(value) return nil unless value.is_a?(String) return nil unless value.start_with?(MARKER) value.sub(MARKER, '') end |
.pipe?(value) ⇒ Boolean
Check if a value is a pipe marker
100 101 102 103 104 |
# File 'lib/ukiryu/io.rb', line 100 def self.pipe?(value) return false unless value.is_a?(String) value.start_with?(MARKER) end |
.to(command) ⇒ String
Create a pipe to a command
78 79 80 |
# File 'lib/ukiryu/io.rb', line 78 def self.to(command) "#{MARKER}#{command}" end |