DecodeSourceDecodeCommentAttribute

class Attribute

Describes an attribute type.

Definitions

PATTERN = /\A\[#{Tag.bracketed_content(:type)}\](\s+(?<details>.*?))?\Z/

Signature

constant

Pattern for matching attribute declarations.

def self.build(directive, match)

Build an attribute from a directive and match.

Signature

parameter directive String

The original directive text.

parameter match MatchData

The regex match data.

Implementation

def self.build(directive, match)
	type = match[:type] or raise "Missing type in attribute match!"
	
	node = self.new(directive, type)
	
	if details = match[:details]
		node.add(Text.new(details))
	end
	
	return node
end

def initialize(directive, type)

Initialize a new attribute.

Signature

parameter directive String

The original directive text.

parameter type String

The type of the attribute.

Implementation

def initialize(directive, type)
	super(directive)
	
	@type = type
end

attr :type

Signature

attribute String

The type of the attribute.