module EditorConfigGenerator # Transforms options given to an EditorConfig object class OptionTransformer def self.transform_options(options) transform_root_option(options) transform_whitespace_option(options) transform_final_newline_option(options) end def self.transform_final_newline_option(options) if options[:insert_final_newline] == 'y' options[:insert_final_newline] = true elsif options[:insert_final_newline] == 'n' options[:insert_final_newline] = false end end def self.transform_whitespace_option(options) if options[:trim_trailing_whitespace] == 'y' options[:trim_trailing_whitespace] = true elsif options[:trim_trailing_whitespace] == 'n' options[:trim_trailing_whitespace] = false end end def self.transform_root_option(options) if options[:root] == 'y' options[:root] = true elsif options[:root] == 'n' options[:root] = false end end end end