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
187
188
189
# File 'lib/conker.rb', line 183

def initialize(declaration_opts)
  declaration_opts.assert_valid_keys :required_in, :type, :default, *ENVIRONMENTS.map(&:to_sym), :delimiter
  if declaration_opts.key?(:delimiter) && declaration_opts[:type] != :array
    raise "Unknown key :delimiter for type :#{declaration_opts[:type] || :string}.  Did you mean :type => :array?"
  end
  @declaration_opts = declaration_opts.with_indifferent_access
end

Instance Method Details

#evaluate(current_environment, config, varname) ⇒ Object



191
192
193
194
195
196
197
# File 'lib/conker.rb', line 191

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