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.
45 46 47 48 49 50 |
# File 'lib/fig/statement/path.rb', line 45 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.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fig/statement/path.rb', line 14 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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fig/statement/path.rb', line 27 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
60 61 62 |
# File 'lib/fig/statement/path.rb', line 60 def deparse_as_version(deparser) return deparser.path(self) end |
#is_environment_variable? ⇒ Boolean
56 57 58 |
# File 'lib/fig/statement/path.rb', line 56 def is_environment_variable?() return true end |
#statement_type ⇒ Object
52 53 54 |
# File 'lib/fig/statement/path.rb', line 52 def statement_type() return 'path' end |