Class: Kubes::Args::Custom
- Inherits:
-
Object
- Object
- Kubes::Args::Custom
- Extended by:
- Memoist
- Includes:
- DslEvaluator, Dsl
- Defined in:
- lib/kubes/args/custom.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #args ⇒ Object
- #build ⇒ Object
- #dig(prop, default = []) ⇒ Object
-
#initialize(name, file) ⇒ Custom
constructor
A new instance of Custom.
Methods included from Dsl
Constructor Details
#initialize(name, file) ⇒ Custom
Returns a new instance of Custom.
8 9 10 11 12 |
# File 'lib/kubes/args/custom.rb', line 8 def initialize(name, file) @name = name.to_s @file = file # IE: .kubes/config/kubectl/args.rb @commands = {} end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/kubes/args/custom.rb', line 7 def name @name end |
Instance Method Details
#args ⇒ Object
21 22 23 24 |
# File 'lib/kubes/args/custom.rb', line 21 def args args = dig("args") args.compact.flatten end |
#build ⇒ Object
14 15 16 17 18 |
# File 'lib/kubes/args/custom.rb', line 14 def build return @commands unless File.exist?(@file) evaluate_file(@file) @commands.deep_stringify_keys! end |
#dig(prop, default = []) ⇒ Object
26 27 28 |
# File 'lib/kubes/args/custom.rb', line 26 def dig(prop, default=[]) @commands.dig(@name, prop) || default end |