Class: Kube::Cluster::QueryBuilder
- Inherits:
-
Object
- Object
- Kube::Cluster::QueryBuilder
- Defined in:
- lib/kube/cluster/query_builder.rb
Instance Method Summary collapse
-
#initialize(command_data) ⇒ QueryBuilder
constructor
A new instance of QueryBuilder.
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(command_data) ⇒ QueryBuilder
Returns a new instance of QueryBuilder.
8 9 10 11 12 13 |
# File 'lib/kube/cluster/query_builder.rb', line 8 def initialize(command_data) @commands = command_data[:commands] || [] @resource = command_data[:resource] @args = command_data[:args] || [] @flags = command_data[:flags] || {} end |
Instance Method Details
#to_a ⇒ Object
19 20 21 22 |
# File 'lib/kube/cluster/query_builder.rb', line 19 def to_a stdout, _status = Open3.capture2("kubectl", *@commands, *resource_arg, *@args, *rendered_flags) stdout.lines.map(&:chomp) end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/kube/cluster/query_builder.rb', line 15 def to_s ["kubectl", *@commands, *resource_arg, *@args, *rendered_flags].join(" ") end |