Class: StringBuilder
- Inherits:
-
Object
- Object
- StringBuilder
- Defined in:
- lib/kube/ctl/string_builder.rb
Instance Method Summary collapse
-
#call(token = nil, **kwargs) ⇒ Object
Override call to handle kwargs: .(description: ‘my frontend’) stores [“my frontend”] in the buffer.
-
#inspect ⇒ Object
Provide a safe, concise representation for REPL/debug output.
Instance Method Details
#call(token = nil, **kwargs) ⇒ Object
Override call to handle kwargs: .(description: ‘my frontend’) stores [“my frontend”] in the buffer.
22 23 24 25 26 27 28 29 30 |
# File 'lib/kube/ctl/string_builder.rb', line 22 def call(token = nil, **kwargs) tap do if token @buffer << [token.to_s, []] elsif kwargs.any? @buffer << [kwargs] end end end |
#inspect ⇒ Object
Provide a safe, concise representation for REPL/debug output.
11 12 13 14 15 16 17 18 |
# File 'lib/kube/ctl/string_builder.rb', line 11 def inspect if $stdout.tty? Kube::Ctl.run(self.to_s) else parts = @buffer.respond_to?(:size) ? @buffer.size : 0 %(#<#{self.class} command=#{command.inspect} parts=#{parts}>) end end |