Class: Yard2steep::Comments
- Inherits:
-
Object
- Object
- Yard2steep::Comments
- Defined in:
- lib/yard2steep/comments.rb
Constant Summary collapse
- S_RE =
/[\s\t]*/
- TYPE_WITH_PAREN_RE =
/ \[ ( [^\]] * ) \] /x
- COMMENT_RE =
/^ \# #{S_RE} @(?:param|return) #{S_RE} #{TYPE_WITH_PAREN_RE} /x
- PARAM_RE =
/ \# #{S_RE} @param #{S_RE} #{TYPE_WITH_PAREN_RE} #{S_RE} (\w+) /x
- RETURN_RE =
/ \# #{S_RE} @return #{S_RE} #{TYPE_WITH_PAREN_RE} /x
Instance Method Summary collapse
-
#initialize(text) ⇒ Comments
constructor
A new instance of Comments.
- #parse_from(m_loc) ⇒ Array(Hash { String => String }, String)
Constructor Details
#initialize(text) ⇒ Comments
Returns a new instance of Comments.
39 40 41 |
# File 'lib/yard2steep/comments.rb', line 39 def initialize(text) @comments_map = extract(text) end |
Instance Method Details
#parse_from(m_loc) ⇒ Array(Hash { String => String }, String)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/yard2steep/comments.rb', line 45 def parse_from(m_loc) Util.assert! { m_loc >= 0 } reset_context! l = m_loc - 1 while l >= 0 comment = @comments_map[l] break unless comment # nil when no more comment exist parse_comment!(comment) l -= 1 end [@p_types, @r_type] end |