Class: Conker::VariableDeclaration

Inherits:
Object
  • Object
show all
Defined in:
lib/conker.rb

Instance Method Summary collapse

Constructor Details

#initialize(declaration_opts) ⇒ VariableDeclaration

Returns a new instance of VariableDeclaration.



183
184
185
186
# File 'lib/conker.rb', line 183

def initialize(declaration_opts)
  declaration_opts.assert_valid_keys :required_in, :type, :default, *ENVIRONMENTS.map(&:to_sym)
  @declaration_opts = declaration_opts.with_indifferent_access
end

Instance Method Details

#evaluate(current_environment, config, varname) ⇒ Object



188
189
190
191
192
193
194
# File 'lib/conker.rb', line 188

def evaluate(current_environment, config, varname)
  @environment = current_environment
  @config = config
  check_missing_value! varname
  check_missing_default!
  from_config_variable_or_default(varname)
end