Class: Travis::Yaml::Nodes::Env::Variables

Inherits:
Scalar
  • Object
show all
Defined in:
lib/travis/yaml/nodes/env.rb

Instance Attribute Summary

Attributes inherited from Scalar

#value

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from Scalar

#!@, #==, [], cast, #cast, #cast?, cast?, default, #default_type, default_type, #each_scalar, #empty?, has_default?, #inspect, #prepare, #visit_child, #visit_scalar, #visit_sequence, #with_value, #with_value!

Methods inherited from Node

#decrypt, #decrypted?, #deep_verify, #dup, #encrypt, #encrypted?, #error, #errors, #errors?, has_default?, #initialize, #method_missing, #nested_warning, #nested_warnings, #prepare, #respond_to_missing?, #serialize, #to_json, #to_legacy_ruby, #to_ruby, #to_s, #to_yaml, #verify, #verify_language, #visit_child, #visit_pair, #visit_scalar, #visit_sequence, #visit_unexpected, #warngings?, #warning, #warnings, #with_value

Constructor Details

This class inherits a constructor from Travis::Yaml::Nodes::Node

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Travis::Yaml::Nodes::Node

Instance Method Details

#visit_key_value(visitor, key, value) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/travis/yaml/nodes/env.rb', line 14

def visit_key_value(visitor, key, value)
  key  = visitor.generate_key(self, key)
  node = Scalar.new
  visitor.accept(node, value)

  if node.errors?
    warning "dropping %p: %s", key, value.errors.join(', ')
  else
    self.value << " " unless self.value.empty?
    self.value << "#{key}=#{Shellwords.escape(value.value)}"
  end
end

#visit_mapping(visitor, value) ⇒ Object



9
10
11
12
# File 'lib/travis/yaml/nodes/env.rb', line 9

def visit_mapping(visitor, value)
  self.value = ""
  visitor.apply_mapping(self, value)
end