Class: Decode::Comment::Yields
- Defined in:
- lib/decode/comment/yields.rb
Overview
Describes a block parameter.
-
‘@yields {|person| … } If a block is given.`
Should contain nested parameters.
Constant Summary collapse
- PATTERN =
/\A(?<block>{.*?})(\s+(?<details>.*?))?\Z/
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Attributes inherited from Tag
#The directive that generated the tag., #directive
Attributes inherited from Node
#The children of this node., #children
Class Method Summary collapse
-
.build(directive, match) ⇒ Object
Build a yields tag from a directive and match.
Instance Method Summary collapse
-
#initialize(directive, block) ⇒ Yields
constructor
Initialize a new yields tag.
Methods inherited from Tag
bracketed_content, match, parse
Methods inherited from Node
#add, #children?, #each, #filter, #text, #traverse
Constructor Details
#initialize(directive, block) ⇒ Yields
Initialize a new yields tag.
37 38 39 40 41 42 |
# File 'lib/decode/comment/yields.rb', line 37 def initialize(directive, block) super(directive) # @type ivar @block: String? @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
44 45 46 |
# File 'lib/decode/comment/yields.rb', line 44 def block @block end |
Class Method Details
.build(directive, match) ⇒ Object
Build a yields tag from a directive and match.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/decode/comment/yields.rb', line 22 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 |