Module: Lino::Builders::Mixins::EnvironmentVariables
- Includes:
- Validation
- Included in:
- CommandLine
- Defined in:
- lib/lino/builders/mixins/environment_variables.rb
Instance Method Summary collapse
- #initialize(state) ⇒ Object
- #with_environment_variable(environment_variable, value) ⇒ Object
- #with_environment_variables(environment_variables) ⇒ Object
Methods included from Validation
Instance Method Details
#initialize(state) ⇒ Object
12 13 14 15 16 |
# File 'lib/lino/builders/mixins/environment_variables.rb', line 12 def initialize(state) @environment_variables = Hamster::Vector.new(state[:environment_variables] || []) super end |
#with_environment_variable(environment_variable, value) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/lino/builders/mixins/environment_variables.rb', line 18 def with_environment_variable(environment_variable, value) with( environment_variables: @environment_variables.add( Model::EnvironmentVariable.new(environment_variable, value) ) ) end |
#with_environment_variables(environment_variables) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/lino/builders/mixins/environment_variables.rb', line 27 def with_environment_variables(environment_variables) return self if nil_or_empty?(environment_variables) environment_variables.entries.inject(self) do |s, var| s.with_environment_variable( var.include?(:name) ? var[:name] : var[0], var.include?(:value) ? var[:value] : var[1] ) end end |