module Fig::Statement::EnvironmentVariable::ClassMethods

Constants

TOKENIZING_SUBEXPRESSION_MATCHER

Public Instance Methods

base_v0_value_validation(variable, raw_value) { |%Q<The value of #{variable} (#{raw_value}) contains whitespace.>| ... } click to toggle source

TODO: Test coverage doesn't appear to be running this.

# File lib/fig/statement/environment_variable.rb, line 67
def base_v0_value_validation(variable, raw_value)
  if raw_value =~ /\s/
    yield %Q<The value of #{variable} (#{raw_value}) contains whitespace.>
    return
  end
  if raw_value =~ /'/
    yield %Q<The value of #{variable} (#{raw_value}) contains a single quote.>
    return
  end
  if raw_value =~ /"/
    yield %Q<The value of #{variable} (#{raw_value}) contains a double quote.>
    return
  end

  return
end
seperate_name_and_value(combined) { |\ %Q<"#{variable}" does not consist solely of alphanumerics and underscores.>| ... } click to toggle source
# File lib/fig/statement/environment_variable.rb, line 50
def seperate_name_and_value(combined, &error_block)
  variable, raw_value = combined.split '=', 2
  if variable !~ Fig::Statement::ENVIRONMENT_VARIABLE_NAME_REGEX
    yield \
      %Q<"#{variable}" does not consist solely of alphanumerics and underscores.>
    return
  end

  return [variable, raw_value || '']
end
tokenize_value(value, &error_block) click to toggle source
# File lib/fig/statement/environment_variable.rb, line 61
def tokenize_value(value, &error_block)
  tokenizer = Fig::StringTokenizer.new TOKENIZING_SUBEXPRESSION_MATCHER, '@'
  return tokenizer.tokenize value, &error_block
end