Merge pull request #389 from Shopify/remove_unnecessary_blank_stuf

Remove unnecessary blank? code
This commit is contained in:
Florian Weingarten
2014-07-23 15:07:26 +02:00
7 changed files with 7 additions and 22 deletions

View File

@@ -11,7 +11,7 @@ module Liquid
end
def blank?
@blank || false
@blank
end
def parse(tokens)
@@ -49,7 +49,7 @@ module Liquid
else
raise SyntaxError.new(options[:locale].t("errors.syntax.tag_termination".freeze, :token => token, :tag_end => TagEnd.inspect))
end
when token.start_with?(VARSTART)
when token.start_with?(VARSTART)
new_var = create_variable(token)
@nodelist << new_var
@children << new_var

View File

@@ -31,7 +31,7 @@ module Liquid
end
def blank?
@blank || false
false
end
def parse_with_selected_parser(markup)
@@ -50,11 +50,12 @@ module Liquid
end
private
def strict_parse_with_error_context(markup)
strict_parse(markup)
rescue SyntaxError => e
e.message << " in \"#{markup.strip}\""
raise e
end
end # Tag
end # Liquid
end
end

View File

@@ -1,5 +1,4 @@
module Liquid
# Capture stores the result of a block into a variable without rendering it inplace.
#
# {% capture heading %}

View File

@@ -43,11 +43,8 @@ module Liquid
end
end
def blank?
false
end
private
def variables_from_string(markup)
markup.split(',').collect do |var|
var =~ /\s*(#{QuotedFragment})\s*/o

View File

@@ -38,10 +38,6 @@ module Liquid
def parse(tokens)
end
def blank?
false
end
def render(context)
partial = load_cached_partial(context)
variable = context[@variable_name || @template_name[1..-2]]

View File

@@ -25,10 +25,6 @@ module Liquid
context.environments.first[@variable] = value + 1
value.to_s
end
def blank?
false
end
end
Template.register_tag('increment'.freeze, Increment)

View File

@@ -60,10 +60,6 @@ class CustomInclude < Liquid::Tag
def parse(tokens)
end
def blank?
false
end
def render(context)
@template_name[1..-2]
end