Module: Fig::Statement::EnvironmentVariable::ClassMethods
- Defined in:
- lib/fig/statement/environment_variable.rb
Instance Method Summary collapse
-
#base_v0_value_validation(variable, raw_value) ⇒ Object
TODO: Test coverage doesn’t appear to be running this.
- #seperate_name_and_value(combined, &error_block) ⇒ Object
- #tokenize_value(value, &error_block) ⇒ Object
Instance Method Details
#base_v0_value_validation(variable, raw_value) ⇒ Object
TODO: Test coverage doesn’t appear to be running this.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fig/statement/environment_variable.rb', line 65 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, &error_block) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fig/statement/environment_variable.rb', line 48 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) ⇒ Object
59 60 61 62 |
# File 'lib/fig/statement/environment_variable.rb', line 59 def tokenize_value(value, &error_block) tokenizer = Fig::StringTokenizer.new TOKENIZING_SUBEXPRESSION_MATCHER, '@' return tokenizer.tokenize value, &error_block end |