Class: Indocker::ContextArgs
- Inherits:
-
Object
- Object
- Indocker::ContextArgs
- Defined in:
- lib/indocker/context_args.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
-
#initialize(name, context_args, parent, container = nil) ⇒ ContextArgs
constructor
A new instance of ContextArgs.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(name, context_args, parent, container = nil) ⇒ ContextArgs
Returns a new instance of ContextArgs.
4 5 6 7 8 9 |
# File 'lib/indocker/context_args.rb', line 4 def initialize(name, context_args, parent, container = nil) @name = name @parent = parent @container = container @context_args = context_args end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/indocker/context_args.rb', line 11 def method_missing(name, *args) if args.size > 0 raise ArgumentError.new("context args does not accept any arguments") end value = @context_args.fetch(name) do Indocker.logger.warn("build arg '#{format_arg(name)}' is not defined#{@container ? " for container :#{@container.name}" : ""}") Indocker.logger.warn("available args: #{@context_args.inspect}") nil end if value.is_a?(Hash) Indocker::ContextArgs.new(name, value, self, @container) else value end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/indocker/context_args.rb', line 2 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
2 3 4 |
# File 'lib/indocker/context_args.rb', line 2 def parent @parent end |