class Yields
Describes a block parameter.
@yields {|person| ... } If a block is given.
Should contain nested parameters.
Definitions
PATTERN = /\A(?<block>{.*?})(\s+(?<details>.*?))?\Z/
Signature
- constant
Pattern for matching yields declarations.
def self.build(directive, match)
Build a yields tag from a directive and match.
Signature
-
parameter
directive
String
The directive name.
-
parameter
match
MatchData
The regex match data.
Implementation
def self.build(directive, match)
block = match[:block] or raise "Missing block in yields match!"
node = self.new(directive, block)
if details = match[:details]
node.add(Text.new(details))
end
return node
end
def initialize(directive, block)
Initialize a new yields tag.
Signature
-
parameter
directive
String
The directive name.
-
parameter
block
String
The block signature.
Implementation
def initialize(directive, block)
super(directive)
# @type ivar @block: String?
@block = block
end