Sha256: 83e62fd1f965920c5c674fa31e642a8e9ceb47f2356520bd7e4a9d8723959235
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 Bytes
Contents
module Grub class GemLine attr_accessor :original_line, :location, :prev_line_comment, :name, :spec def initialize(name:, original_line:, location:, prev_line_comment: nil) @name = name @original_line = original_line @location = location @prev_line_comment = prev_line_comment end def comment leading_spaces_count = original_line.length - original_line.lstrip.length leading_spaces = original_line[0..leading_spaces_count - 1] if leading_spaces_count > 0 comment = "# #{description}" comment << " (#{website})" unless website.nil? || website.empty? comment << "\n" "#{leading_spaces}#{comment}" end def should_insert? prev_line_comment.nil? || !prev_line_comment.include?(comment) end def description spec.summary if spec end def website spec.homepage if spec end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grub-0.0.1 | lib/grub/gem_line.rb |