Class: Fig::Statement::Path
- Inherits:
-
Fig::Statement
- Object
- Fig::Statement
- Fig::Statement::Path
- Includes:
- EnvironmentVariable
- Defined in:
- lib/fig/statement/path.rb
Overview
A statement that specifies or modifies a path environment variable, e.g. “append”, “path”, “add” (though those are all synonyms).
Constant Summary
Constants inherited from Fig::Statement
ENVIRONMENT_VARIABLE_NAME_REGEX
Instance Attribute Summary
Attributes included from EnvironmentVariable
Attributes inherited from Fig::Statement
#column, #line, #source_description
Class Method Summary collapse
-
.parse_name_value(combined, &error_block) ⇒ Object
Yields on error.
- .parse_v0_name_value(combined, &error_block) ⇒ Object
Instance Method Summary collapse
- #deparse_as_version(deparser) ⇒ Object
-
#initialize(line_column, source_description, name, tokenized_value) ⇒ Path
constructor
A new instance of Path.
- #is_environment_variable? ⇒ Boolean
- #statement_type ⇒ Object
Methods included from EnvironmentVariable
included, #minimum_grammar_for_emitting_input, #minimum_grammar_for_publishing
Methods inherited from Fig::Statement
#is_asset?, #minimum_grammar_for_emitting_input, #minimum_grammar_for_publishing, position_description, #position_string, #urls, #walk_statements
Constructor Details
#initialize(line_column, source_description, name, tokenized_value) ⇒ Path
Returns a new instance of Path.
43 44 45 46 47 48 |
# File 'lib/fig/statement/path.rb', line 43 def initialize(line_column, source_description, name, tokenized_value) super(line_column, source_description) @name = name @tokenized_value = tokenized_value end |
Class Method Details
.parse_name_value(combined, &error_block) ⇒ Object
Yields on error.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fig/statement/path.rb', line 12 def self.parse_name_value(combined, &error_block) variable, raw_value = seperate_name_and_value combined, &error_block tokenized_value = tokenize_value(raw_value, &error_block) if tokenized_value.to_escaped_string.length < 1 yield %Q<The value of path variable #{variable} is empty.> return end return [variable, tokenized_value] end |
.parse_v0_name_value(combined, &error_block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fig/statement/path.rb', line 25 def self.parse_v0_name_value(combined, &error_block) variable, raw_value = seperate_name_and_value combined, &error_block if raw_value.length < 1 yield %Q<The value of path variable #{variable} is empty.> return end base_v0_value_validation(variable, raw_value, &error_block) if raw_value =~ /([;:<>|])/ yield %Q<The value of path variable #{variable} (#{raw_value}) contains a "#{$1}" character.> return end return [variable, tokenize_value(raw_value, &error_block)] end |
Instance Method Details
#deparse_as_version(deparser) ⇒ Object
58 59 60 |
# File 'lib/fig/statement/path.rb', line 58 def deparse_as_version(deparser) return deparser.path(self) end |
#is_environment_variable? ⇒ Boolean
54 55 56 |
# File 'lib/fig/statement/path.rb', line 54 def is_environment_variable?() return true end |
#statement_type ⇒ Object
50 51 52 |
# File 'lib/fig/statement/path.rb', line 50 def statement_type() return 'path' end |