Rename before_method as liquid_method_missing

This commit is contained in:
Thierry Joyal
2015-10-28 17:28:19 +00:00
parent 31d7682f4e
commit ac041c4ad1
4 changed files with 16 additions and 15 deletions
+4 -4
View File
@@ -18,15 +18,15 @@ module Liquid
# tmpl = Liquid::Template.parse( ' {% for product in product.top_sales %} {{ product.name }} {%endfor%} ' )
# tmpl.render('product' => ProductDrop.new ) # will invoke top_sales query.
#
# Your drop can either implement the methods sans any parameters or implement the before_method(name) method which is a
# catch all.
# Your drop can either implement the methods sans any parameters
# or implement the liquid_method_missing(name) method which is a catch all.
class Drop
attr_writer :context
EMPTY_STRING = ''.freeze
# Catch all for the method
def before_method(_method)
def liquid_method_missing(_method)
nil
end
@@ -35,7 +35,7 @@ module Liquid
if method_or_key && method_or_key != EMPTY_STRING && self.class.invokable?(method_or_key)
send(method_or_key)
else
before_method(method_or_key)
liquid_method_missing(method_or_key)
end
end