Class: Xhive::TagFactory
- Inherits:
-
Object
- Object
- Xhive::TagFactory
- Defined in:
- lib/xhive/tag_factory.rb
Class Method Summary collapse
-
.create_class(name, url) ⇒ Object
Public: creates and registers the tag class for a specific name/url pair.
Class Method Details
.create_class(name, url) ⇒ Object
Public: creates and registers the tag class for a specific name/url pair.
name - The String containing the widget name. url - The String containing the widget url.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/xhive/tag_factory.rb', line 8 def self.create_class(name, url) klass = Class.new(Xhive::BaseTag) do const_set 'URL', url def initialize(tag_name, markup, tokens) @url = self.class.const_get 'URL' super end end Liquid.const_set name, klass Liquid::Template.register_tag(name.underscore, "Liquid::#{name}".constantize) end |