Method: Lookbook::CustomTag#initialize
- Defined in:
- lib/lookbook/tags/custom_tag.rb
#initialize(tag_name, text = nil, *args) ⇒ CustomTag
Returns a new instance of CustomTag.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lookbook/tags/custom_tag.rb', line 7 def initialize(tag_name, text = nil, *args) tag_definition = Engine..get_tag(tag_name) unless tag_definition raise ParserError.new "Unknown custom tag type '#{tag_name}'" end super(tag_name, text.to_s, *args) @custom_attributes = Store.new @arg_names = tag_definition..fetch(:named_args, []) @after_parse = tag_definition..fetch(:after_parse, nil) validate_arg_names @tag_args = parse_tag @after_parse.call(self) if @after_parse.respond_to?(:call) end |