class Constant
Represents a constant type declaration.
@constant [Regexp] Pattern for matching parameters.
Definitions
PATTERN = /\A\[#{Tag.bracketed_content(:type)}\](\s+(?<details>.*?))?\Z/
Signature
- constant
Pattern for matching constant declarations.
def self.build(directive, match)
Build a constant from a directive and regex match.
Signature
-
parameter
directive
String
The original directive text.
-
parameter
match
MatchData
The regex match data containing type and details.
-
returns
Constant
A new constant object.
Implementation
def self.build(directive, match)
type = match[:type] or raise "Missing type in constant 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 constant.
Signature
-
parameter
directive
String
The directive that generated the tag.
-
parameter
type
String
The type of the constant.
Implementation
def initialize(directive, type)
super(directive)
@type = type
end
attr :type
Signature
-
attribute
String
The type of the constant.