Class: Pod::YAMLConverter
- Inherits:
-
Object
- Object
- Pod::YAMLConverter
- Defined in:
- lib/cocoapods-core/yaml_converter.rb
Overview
This class misses important features necessary for a correct YAML serialization and thus it is safe to use only for the Lockfile. The missing features include:
-
Strings are never quoted even when ambiguous.
Converts objects to their YAML representation.
This class was created for the need having control on how the YAML is representation is generated. In details it provides:
-
sorting for hashes in ruby 1.8.x
-
ability to hint the sorting of the keys of a dictionary when converting it. In this case the keys are also separated by an additional new line feed for readability.
Class Method Summary collapse
-
.convert(value) ⇒ String
Returns the YAML representation of the given object.
- .convert_hash(value, hash_keys_hint, line_separator = "\n") ⇒ Object
Class Method Details
.convert(value) ⇒ String
Returns the YAML representation of the given object. If the given object is an Hash it accepts an optional hint for sorting the keys.
34 35 36 37 |
# File 'lib/cocoapods-core/yaml_converter.rb', line 34 def convert(value) result = process_according_to_class(value) result << "\n" end |
.convert_hash(value, hash_keys_hint, line_separator = "\n") ⇒ Object
39 40 41 42 |
# File 'lib/cocoapods-core/yaml_converter.rb', line 39 def convert_hash(value, hash_keys_hint, line_separator = "\n") result = process_hash(value, hash_keys_hint, line_separator) result << "\n" end |