Class: Travis::Yaml::Serializer::Legacy

Inherits:
Ruby show all
Defined in:
lib/travis/yaml/serializer/legacy.rb

Instance Attribute Summary

Attributes inherited from Generic

#options

Instance Method Summary collapse

Methods inherited from Ruby

#serialize_mapping, #serialize_value

Methods inherited from Generic

#initialize, serialize, #serialize, #serialize_binary, #serialize_bool, #serialize_float, #serialize_key, #serialize_mapping, #serialize_regexp, #serialize_scalar, #serialize_secure, #serialize_sequence, #serialize_str, #serialize_time, #serialize_value, #symbol_keys?

Constructor Details

This class inherits a constructor from Travis::Yaml::Serializer::Generic

Instance Method Details

#serialize_decrypted(value) ⇒ Object



27
28
29
# File 'lib/travis/yaml/serializer/legacy.rb', line 27

def serialize_decrypted(value)
  value.decrypted_string
end

#serialize_encrypted(value) ⇒ Object



23
24
25
# File 'lib/travis/yaml/serializer/legacy.rb', line 23

def serialize_encrypted(value)
  { serialize_key('secure') => value.encrypted_string }
end

#serialize_error(node) ⇒ Object



9
10
11
12
13
14
# File 'lib/travis/yaml/serializer/legacy.rb', line 9

def serialize_error(node)
  {
    serialize_key('.result')         => 'parse_error',
    serialize_key('.result_message') => node.errors.join("\n")
  }
end

#serialize_root(node) ⇒ Object



4
5
6
7
# File 'lib/travis/yaml/serializer/legacy.rb', line 4

def serialize_root(node)
  return serialize_error(node) if node.errors?
  super.merge(serialize_warnings(node))
end

#serialize_warnings(node) ⇒ Object



16
17
18
19
20
21
# File 'lib/travis/yaml/serializer/legacy.rb', line 16

def serialize_warnings(node)
  {
    serialize_key('.result')          => 'configured',
    serialize_key('.result_warnings') => node.nested_warnings
  }
end