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 collapse

CommentPattern =

:nodoc:

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

Instance Attribute Summary collapse

Attributes inherited from HTMLToken

#raw

Instance Method Summary collapse

Methods inherited from HTMLToken

#css_class, #escape_html, #to_html

Methods inherited from Object

deprecate_class_method, deprecate_method, inherited

Constructor Details

#initialize(raw) ⇒ HTMLComment

Returns 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

#contentsObject

Returns the value of attribute contents.



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

def contents
  @contents
end