class Giteaucrat::Formatters::RubyFormatter

Constants

CODING_REGEXP

@return [String]

COMMENT_PARTS

Public Instance Methods

encoding() click to toggle source
# File lib/giteaucrat/formatters/ruby_formatter.rb, line 49
def encoding
  @encoding || (include_encoding? && '# coding: utf-8' || nil)
end
format_line(line) click to toggle source
# File lib/giteaucrat/formatters/ruby_formatter.rb, line 26
def format_line(line)
  first, _, last = comment_parts
  "#{first} #{line} #{last}"
end
include_encoding?() click to toggle source
# File lib/giteaucrat/formatters/ruby_formatter.rb, line 45
def include_encoding?
  repo.include_encoding?
end
parse_comment(comment) click to toggle source
# File lib/giteaucrat/formatters/ruby_formatter.rb, line 37
def parse_comment(comment)
  middle = Regexp.escape(comment_parts[1])
  comment_lines = comment.split("\n").map do |line|
    line.sub(/\A#{middle}\s?/, '').sub(/\s*#{middle}\s*\Z/, '')
  end
  @comment_lines = comment_lines
end