Class: Lookbook::TagProvider

Inherits:
YARD::Tags::Tag
  • Object
show all
Defined in:
lib/lookbook/tags/tag_provider.rb

Class Method Summary collapse

Class Method Details

.new(tag_name, text, types = nil, name = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lookbook/tags/tag_provider.rb', line 3

def self.new(tag_name, text, types = nil, name = nil)
  tag_name = tag_name.to_s

  if tag_name == "custom"
    raise NameError.new "'custom' is a reserved tag name and cannot be used"
  end

  # Handle aliasing of removed `@component` tags
  tag_name = "renders" if tag_name == "component"

  begin
    tag_class = "Lookbook::#{tag_name.camelize}Tag".constantize
    tag_class.new(text)
  rescue NameError
    CustomTag.new(tag_name, text)
  end
end