Sha256: 6d652d8dcea1de9a57e2f63d7e0bbab0a402a1bcb06c8479bff031900ce355c3
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
# coding: utf-8 # frozen_string_literal: true ############################################ # © Alex Semyonov, 2013—2017, MIT License # # Author: Alex Semyonov <alex@semyonov.us> # ############################################ require 'giteaucrat/formatters/formatter' module Giteaucrat module Formatters class JavaFormatter < Formatter COMMENT_PARTS = %w[/* * */].freeze COPYRIGHT_REGEXP = %r{/\*(?<ruler>\*+)\n(?<copyrights>(\s\*\s*[^\s\*]+.*\n)+)(\s\*\s*\*?\n(?<comment>(\s\*\s?.*\*?\n)+))?(\s\g<ruler>\**/\n+)} def format_line(line) " * #{line} *" end def header_ruler(line_width) "/*#{'*' * (line_width - 3)}" end def footer_ruler(line_width) " #{'*' * (line_width - 3)}*/" end def parse_comment(comment) comment_lines = comment.split("\n").map do |line| line.sub(/\A\s\*\s?/, '').sub(/\s*\*\s*\Z/, '') end @comment_lines = comment_lines end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
giteaucrat-0.1.0 | lib/giteaucrat/formatters/java_formatter.rb |
giteaucrat-0.0.8 | lib/giteaucrat/formatters/java_formatter.rb |