Compare commits

...

2 Commits

Author SHA1 Message Date
Mike Angell
cd347008ee Expand usage tracking 2019-09-24 05:22:14 +10:00
Mike Angell
9a9564499a New liquid tracking. 2019-09-24 05:19:48 +10:00
2 changed files with 4 additions and 1 deletions

View File

@@ -219,12 +219,16 @@ module Liquid
def try_variable_find_in_environments(key, raise_on_not_found:) def try_variable_find_in_environments(key, raise_on_not_found:)
@environments.each do |environment| @environments.each do |environment|
found_variable = lookup_and_evaluate(environment, key, raise_on_not_found: raise_on_not_found) found_variable = lookup_and_evaluate(environment, key, raise_on_not_found: raise_on_not_found)
Usage.increment("environment_has_a_default_proc") if environment.respond_to?(:default_proc) && environment.default_proc
Usage.increment("environment_has_key_but_is_nil") if environment.respond_to?(:key?) && environment.key?(key) && found_variable.nil?
if !found_variable.nil? || @strict_variables && raise_on_not_found if !found_variable.nil? || @strict_variables && raise_on_not_found
return found_variable return found_variable
end end
end end
@static_environments.each do |environment| @static_environments.each do |environment|
found_variable = lookup_and_evaluate(environment, key, raise_on_not_found: raise_on_not_found) found_variable = lookup_and_evaluate(environment, key, raise_on_not_found: raise_on_not_found)
Usage.increment("static_environment_has_a_default_proc") if environment.respond_to?(:default_proc) && environment.default_proc
Usage.increment("static_environment_has_key_but_is_nil") if environment.respond_to?(:key?) && environment.key?(key) && found_variable.nil?
if !found_variable.nil? || @strict_variables && raise_on_not_found if !found_variable.nil? || @strict_variables && raise_on_not_found
return found_variable return found_variable
end end

View File

@@ -423,7 +423,6 @@ module Liquid
def default(input, default_value = '') def default(input, default_value = '')
if !input || input.respond_to?(:empty?) && input.empty? if !input || input.respond_to?(:empty?) && input.empty?
Usage.increment("default_filter_received_false_value") if input == false # See https://github.com/Shopify/liquid/issues/1127
default_value default_value
else else
input input