Class: Arrow::HTMLComment

Inherits:
HTMLToken show all
Defined in:
lib/arrow/htmltokenizer.rb

Overview

Class for tokens output by Arrow::HTMLTokenizer for HTML comments.

Constant Summary

CommentPattern =
/^<!--((?:[^-]|-(?!-))*)-->$/

Instance Attribute Summary

Instance Method Summary

Methods inherited from HTMLToken

#css_class, #escape_html, #to_html

Methods inherited from Object

deprecate_class_method, deprecate_method, inherited

Methods included from Loggable

#log

Constructor Details

- (HTMLComment) initialize(raw)

A new instance of HTMLComment



182
183
184
185
186
187
188
189
190
191
# File 'lib/arrow/htmltokenizer.rb', line 182

def initialize( raw )
  super

  unless (( match = CommentPattern.match(raw) ))
    raise ArgumentError,
      "Malformed comment %p" % raw
  end

  @contents = match[1]
end

Instance Attribute Details

- (Object) contents

Returns the value of attribute contents



193
194
195
# File 'lib/arrow/htmltokenizer.rb', line 193

def contents
  @contents
end