Class: Fig::Statement::Set

Inherits:
Fig::Statement show all
Includes:
EnvironmentVariable
Defined in:
lib/fig/statement/set.rb

Overview

A statement that sets the value of an environment variable.

Constant Summary

Constants inherited from Fig::Statement

ENVIRONMENT_VARIABLE_NAME_REGEX

Instance Attribute Summary

Attributes included from EnvironmentVariable

#name, #tokenized_value

Attributes inherited from Fig::Statement

#column, #line, #source_description

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ Set

Returns a new instance of Set.



25
26
27
28
29
30
# File 'lib/fig/statement/set.rb', line 25

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.



13
14
15
16
17
# File 'lib/fig/statement/set.rb', line 13

def self.parse_name_value(combined, &error_block)
  variable, raw_value = seperate_name_and_value combined, &error_block

  return [variable, tokenize_value(raw_value, &error_block)]
end

.parse_v0_name_value(combined, &error_block) ⇒ Object



19
20
21
22
23
# File 'lib/fig/statement/set.rb', line 19

def self.parse_v0_name_value(combined, &error_block)
  variable, raw_value = seperate_name_and_value combined, &error_block
  base_v0_value_validation(variable, raw_value, &error_block)
  return [variable, tokenize_value(raw_value, &error_block)]
end

Instance Method Details

#deparse_as_version(deparser) ⇒ Object



40
41
42
# File 'lib/fig/statement/set.rb', line 40

def deparse_as_version(deparser)
  return deparser.set(self)
end

#is_environment_variable?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fig/statement/set.rb', line 36

def is_environment_variable?()
  return true
end

#statement_typeObject



32
33
34
# File 'lib/fig/statement/set.rb', line 32

def statement_type()
  return 'set'
end