class StringBuilder
Nested
Definitions
def inspect
Provide a safe, concise representation for REPL/debug output.
Implementation
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
def call(token = nil, **kwargs)
Override call to handle kwargs: .(description: 'my frontend')
stores [description: "my frontend"] in the buffer.
Implementation
def call(token = nil, **kwargs)
tap do
if token
@buffer << [token.to_s, []]
elsif kwargs.any?
@buffer << [kwargs]
end
end
end