Class: Kuby::Pipe
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
-
#initialize(name, cli) ⇒ Pipe
constructor
A new instance of Pipe.
- #success? ⇒ Boolean
- #wrap(&block) ⇒ Object
Constructor Details
#initialize(name, cli) ⇒ Pipe
Returns a new instance of Pipe.
104 105 106 107 108 109 |
# File 'lib/kuby/dev_setup.rb', line 104 def initialize(name, cli) @name = T.let(name, Symbol) @cli = T.let(cli, T.untyped) @out = T.let(StringIO.new, StringIO) @err = T.let(StringIO.new, StringIO) end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
95 96 97 |
# File 'lib/kuby/dev_setup.rb', line 95 def cli @cli end |
#err ⇒ Object (readonly)
Returns the value of attribute err.
101 102 103 |
# File 'lib/kuby/dev_setup.rb', line 101 def err @err end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
92 93 94 |
# File 'lib/kuby/dev_setup.rb', line 92 def name @name end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
98 99 100 |
# File 'lib/kuby/dev_setup.rb', line 98 def out @out end |
Instance Method Details
#success? ⇒ Boolean
119 120 121 |
# File 'lib/kuby/dev_setup.rb', line 119 def success? cli.last_status.nil? || cli.last_status.success? end |
#wrap(&block) ⇒ Object
112 113 114 115 116 |
# File 'lib/kuby/dev_setup.rb', line 112 def wrap(&block) cli.with_pipes(out, err) do block.call end end |