class Giteaucrat::Formatters::Formatter

Constants

HASHBANG_REGEXP

Attributes

comment_lines[R]

Public Instance Methods

comment?() click to toggle source
# File lib/giteaucrat/formatters/formatter.rb, line 77
def comment?
  !!@comment_lines
end
comment_parts() click to toggle source
# File lib/giteaucrat/formatters/formatter.rb, line 39
def comment_parts
  self.class.const_get(:COMMENT_PARTS)
end
format_line(line) click to toggle source
# File lib/giteaucrat/formatters/formatter.rb, line 57
def format_line(line)
  "  #{line}  "
end
header_ruler(line_width) click to toggle source
# File lib/giteaucrat/formatters/formatter.rb, line 43
def header_ruler(line_width)
  ruler(line_width)
end
parse_comment(comment) click to toggle source
# File lib/giteaucrat/formatters/formatter.rb, line 70
def parse_comment(comment)
  @comment_lines = comment.split("\n")
  @copyright_lines = nil
end
ruler(line_width) click to toggle source
# File lib/giteaucrat/formatters/formatter.rb, line 51
def ruler(line_width)
  first, middle, last = comment_parts
  ruler_width = (line_width - first.size - last.size) / middle.size
  "#{first}#{middle * ruler_width}#{last}"
end

Private Instance Methods

contents() click to toggle source
# File lib/giteaucrat/formatters/formatter.rb, line 125
def contents
  @contents ||= read_contents
end
file() click to toggle source

@return [Giteaucrat::File]

# File lib/giteaucrat/formatters/formatter.rb, line 121
def file
  __getobj__
end