Module: TTY::Config::Generator Private
- Defined in:
- lib/tty/config/generator.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Responsible for converting a data object into content in INI format
Class Method Summary collapse
-
.generate(data, separator: "=") ⇒ String
Generate file content based on the data hash.
Class Method Details
.generate(data, separator: "=") ⇒ String
Generate file content based on the data hash
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tty/config/generator.rb', line 24 def self.generate(data, separator: "=") sections_and_values = group_into_sections_and_values(data) values = generate_values(sections_and_values[:values], separator) values << "" unless values.empty? sections = generate_sections(sections_and_values[:sections], separator) content = values + sections content.join("\n") end |