class CodeFormatter::ClangFormatFormatter

Public Instance Methods

files_filter() click to toggle source
# File lib/code_formatter/formatters/clang_format_formatter.rb, line 16
def files_filter
  "'*.h' '*.m' '*.mm' '*.c' '*.cpp'"
end
format_files(files) click to toggle source
# File lib/code_formatter/formatters/clang_format_formatter.rb, line 8
def format_files(files)
  `clang-format -i -style="#{style_dump}" #{files.join(' ')}`
end
shell_command() click to toggle source
# File lib/code_formatter/formatters/clang_format_formatter.rb, line 12
def shell_command
  'clang-format'
end

Private Instance Methods

style_dump() click to toggle source
# File lib/code_formatter/formatters/clang_format_formatter.rb, line 22
def style_dump
  style_yaml.to_s.gsub('=>', ' : ')
end
style_yaml() click to toggle source
# File lib/code_formatter/formatters/clang_format_formatter.rb, line 26
def style_yaml
  file = File.expand_path('../../resources/clang_format_style.yml', __FILE__)
  YAML.load_file(file)
end