Class: YARD::Tags::DefaultFactory
- Inherits:
-
Object
- Object
- YARD::Tags::DefaultFactory
- Defined in:
- lib/yard/tags/default_factory.rb
Constant Summary
- TYPELIST_OPENING_CHARS =
'[({<'- TYPELIST_CLOSING_CHARS =
'>})]'
Instance Method Summary
- - (Tag) parse_tag(tag_name, text) Parses tag text and creates a new tag with descriptive text.
- - (Tag) parse_tag_with_name(tag_name, text) Parses tag text and creates a new tag with a key name and descriptive text.
- - (Object) parse_tag_with_options(tag_name, text)
- - (Object) parse_tag_with_raw_text(tag_name, text, raw_text)
- - (Object) parse_tag_with_raw_title_and_text(tag_name, text, raw_text)
- - (Tag) parse_tag_with_types(tag_name, text) Parses tag text and creates a new tag with formally declared types and descriptive text.
- - (Tag) parse_tag_with_types_and_name(tag_name, text) Parses tag text and creates a new tag with formally declared types, a key name and descriptive text.
- - (Object) parse_tag_with_types_name_and_default(tag_name, text)
Instance Method Details
- (Tag) parse_tag(tag_name, text)
Parses tag text and creates a new tag with descriptive text
13 14 15 |
# File 'lib/yard/tags/default_factory.rb', line 13 def parse_tag(tag_name, text) Tag.new(tag_name, text) end |
- (Tag) parse_tag_with_name(tag_name, text)
Parses tag text and creates a new tag with a key name and descriptive text
23 24 25 26 |
# File 'lib/yard/tags/default_factory.rb', line 23 def parse_tag_with_name(tag_name, text) name, text = *extract_name_from_text(text) Tag.new(tag_name, text, nil, name) end |
- (Object) parse_tag_with_options(tag_name, text)
76 77 78 79 |
# File 'lib/yard/tags/default_factory.rb', line 76 def (tag_name, text) name, text = *extract_name_from_text(text) OptionTag.new(tag_name, name, parse_tag_with_types_name_and_default(tag_name, text)) end |
- (Object) parse_tag_with_raw_text(tag_name, text, raw_text)
54 55 56 |
# File 'lib/yard/tags/default_factory.rb', line 54 def parse_tag_with_raw_text(tag_name, text, raw_text) Tag.new(tag_name, raw_text) end |
- (Object) parse_tag_with_raw_title_and_text(tag_name, text, raw_text)
58 59 60 61 |
# File 'lib/yard/tags/default_factory.rb', line 58 def parse_tag_with_raw_title_and_text(tag_name, text, raw_text) title, desc = *extract_title_and_desc_from_raw_text(raw_text) Tag.new(tag_name, desc, nil, title) end |
- (Tag) parse_tag_with_types(tag_name, text)
Parses tag text and creates a new tag with formally declared types and descriptive text
35 36 37 38 39 |
# File 'lib/yard/tags/default_factory.rb', line 35 def parse_tag_with_types(tag_name, text) name, types, text = *extract_types_and_name_from_text(text) raise TagFormatError, "cannot specify a name before type list for '@#{tag_name}'" if name Tag.new(tag_name, text, types) end |
- (Tag) parse_tag_with_types_and_name(tag_name, text)
Parses tag text and creates a new tag with formally declared types, a key name and descriptive text
48 49 50 51 52 |
# File 'lib/yard/tags/default_factory.rb', line 48 def parse_tag_with_types_and_name(tag_name, text) name, types, text = *extract_types_and_name_from_text(text) name, text = *extract_name_from_text(text) unless name Tag.new(tag_name, text, types, name) end |
- (Object) parse_tag_with_types_name_and_default(tag_name, text)
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/yard/tags/default_factory.rb', line 63 def parse_tag_with_types_name_and_default(tag_name, text) # Can't allow () in a default tag, otherwise the grammar is too ambiguous when types is omitted. open, close = TYPELIST_OPENING_CHARS.gsub('(', ''), TYPELIST_CLOSING_CHARS.gsub(')', '') name, types, text = *extract_types_and_name_from_text(text, open, close) name, text = *extract_name_from_text(text) unless name if text =~ /\A\(/ _, default, text = *extract_types_and_name_from_text(text, '(', ')') DefaultTag.new(tag_name, text, types, name, default) else DefaultTag.new(tag_name, text, types, name, nil) end end |