Class: Liquid::Tags::Partial
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Liquid::Tags::Partial
- Defined in:
- app/lib/liquid/tags/partial.rb
Instance Method Summary collapse
-
#initialize(tag_name, name, tokens) ⇒ Partial
constructor
A new instance of Partial.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, name, tokens) ⇒ Partial
Returns a new instance of Partial.
7 8 9 10 |
# File 'app/lib/liquid/tags/partial.rb', line 7 def initialize(tag_name, name, tokens) super @name = name.strip.remove("'") end |
Instance Method Details
#render(context) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/lib/liquid/tags/partial.rb', line 12 def render(context) new_context = context.environments.first # Load up from file system partial_path = Rails.root.join('app','lib','liquid','partials', "#{@name}.liquid") content = File.read(partial_path) Liquid::ParseEnvironment.parse(content).render(new_context).html_safe end |