Class: Kube::Ctl::Instance
- Inherits:
-
Object
- Object
- Kube::Ctl::Instance
- Defined in:
- lib/kube/ctl/instance.rb
Constant Summary collapse
- GEM_ROOT =
File.('../../..', __dir__)
- COMMAND_TREE =
JSON.parse( File.read(File.join(GEM_ROOT, 'data', 'kubectl-command-tree-v1-minimal.json')) )
- ROOT =
TreeNode.new( name: 'kubectl', type: :command, children: TreeNode.build(COMMAND_TREE) )
Instance Attribute Summary collapse
-
#kubeconfig ⇒ Object
readonly
Returns the value of attribute kubeconfig.
Instance Method Summary collapse
-
#initialize(kubeconfig: ENV['KUBECONFIG']) ⇒ Instance
constructor
When kubeconfig is nil, no –kubeconfig flag is passed and kubectl falls back to its own default (~/.kube/config).
- #inspect ⇒ Object
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(kubeconfig: ENV['KUBECONFIG']) ⇒ Instance
When kubeconfig is nil, no –kubeconfig flag is passed and kubectl falls back to its own default (~/.kube/config).
24 25 26 |
# File 'lib/kube/ctl/instance.rb', line 24 def initialize(kubeconfig: ENV['KUBECONFIG']) @kubeconfig = kubeconfig end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
28 29 30 |
# File 'lib/kube/ctl/instance.rb', line 28 def method_missing(name, *args, &block) root_node.public_send(name, *args, &block) end |
Instance Attribute Details
#kubeconfig ⇒ Object (readonly)
Returns the value of attribute kubeconfig.
20 21 22 |
# File 'lib/kube/ctl/instance.rb', line 20 def kubeconfig @kubeconfig end |
Instance Method Details
#inspect ⇒ Object
36 37 38 |
# File 'lib/kube/ctl/instance.rb', line 36 def inspect "#<#{self.class.name} kubeconfig=#{@kubeconfig.inspect}>" end |
#respond_to_missing?(name, include_private = false) ⇒ Boolean
32 33 34 |
# File 'lib/kube/ctl/instance.rb', line 32 def respond_to_missing?(name, include_private = false) root_node.respond_to?(name) || super end |