class HTree::Comment

Attributes

content[R]

Public Class Methods

new(content) click to toggle source
# File htree/leaf.rb, line 71
def Comment.new(content)
  content = content.gsub(/-(-+)/) { '-' + ' -' * $1.length }.sub(/-\z/, '- ')
  new! content
end
parse(raw_string) click to toggle source
# File htree/parse.rb, line 401
def Comment.parse(raw_string)
  unless /\A#{Pat::Comment_C}\z/o =~ raw_string
    raise HTree::Error, "cannot recognize as comment: #{raw_string.inspect}"
  end

  content = $1

  result = Comment.new(content)
  result.raw_string = raw_string
  result
end

Protected Instance Methods

initialize(content) click to toggle source
# File htree/leaf.rb, line 76
def initialize(content) # :notnew:
  init_raw_string
  if /--/ =~ content || /-\z/ =~ content
    raise HTree::Error, "invalid comment content: #{content.inspect}"
  end
  @content = content
end