Sha256: 576bc9b46e292664e2745794b68d2d2e5084459cc3a798b7c19beab810556c79
Contents?: true
Size: 703 Bytes
Versions: 1
Compression:
Stored size: 703 Bytes
Contents
module EditorConfigGenerator # Generates a .editorconfig file when given a valid configuration object class FileGenerator def initialize(configs) @configs = configs end def preview_output output = '' @configs.each do |config| if output.include? 'root=' output << config.to_s_without_root next end output << config.to_s end return output.rstrip if @configs.size > 1 output end def generate_config_file(location = '.editorconfig') File.delete(location) if File.exist? location file = File.new(location, 'w') file.print(preview_output) file.close file end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
editorconfig_generator-0.2.3 | lib/editorconfig/file_generator.rb |