class Comment

Attributes

lines[RW]
type[RW]

Public Class Methods

new(init_line) click to toggle source
# File lib/mark_set_go/comment.rb, line 4
def initialize(init_line)
  @lines = [init_line]
  set_type
end

Public Instance Methods

remove_comment(line) click to toggle source
# File lib/mark_set_go/comment.rb, line 17
def remove_comment(line)
  if /^\/\//.match(line)
    line.gsub(/^\/\//, '')
  elsif /^\/\*/.match(line)
    line.gsub(/^\/\*/, '')
  else
    line
  end
end
set_type() click to toggle source
# File lib/mark_set_go/comment.rb, line 9
def set_type
  if @lines.first.start_with? "/*"
    @type = "block"
  else
    @type = "line"
  end
end
to_s() click to toggle source
# File lib/mark_set_go/comment.rb, line 27
def to_s
  @lines.map { |line| remove_comment(line) }.join("")
end