mirror of
https://github.com/kemko/liquid.git
synced 2026-01-03 16:55:40 +03:00
Revert some freezes on non-literals
This commit is contained in:
@@ -92,7 +92,7 @@ module Liquid
|
||||
end
|
||||
|
||||
def block_delimiter
|
||||
"end#{block_name}".freeze
|
||||
"end#{block_name}"
|
||||
end
|
||||
|
||||
def block_name
|
||||
|
||||
@@ -61,7 +61,7 @@ module Liquid
|
||||
end
|
||||
|
||||
def inspect
|
||||
"#<Condition #{[@left, @operator, @right].compact.join(' '.freeze)}>".freeze
|
||||
"#<Condition #{[@left, @operator, @right].compact.join(' '.freeze)}>"
|
||||
end
|
||||
|
||||
private
|
||||
@@ -94,7 +94,7 @@ module Liquid
|
||||
|
||||
left, right = context[left], context[right]
|
||||
|
||||
operation = self.class.operators[op] || raise(ArgumentError.new("Unknown operator #{op}".freeze))
|
||||
operation = self.class.operators[op] || raise(ArgumentError.new("Unknown operator #{op}"))
|
||||
|
||||
if operation.respond_to?(:call)
|
||||
operation.call(self, left, right)
|
||||
|
||||
@@ -45,7 +45,7 @@ module Liquid
|
||||
def add_filters(filters)
|
||||
filters = [filters].flatten.compact
|
||||
filters.each do |f|
|
||||
raise ArgumentError, "Expected module but got: #{f.class}".freeze unless f.is_a?(Module)
|
||||
raise ArgumentError, "Expected module but got: #{f.class}" unless f.is_a?(Module)
|
||||
Strainer.add_known_filter(f)
|
||||
end
|
||||
|
||||
@@ -82,9 +82,9 @@ module Liquid
|
||||
|
||||
case e
|
||||
when SyntaxError
|
||||
"Liquid syntax error: #{e.message}".freeze
|
||||
"Liquid syntax error: #{e.message}"
|
||||
else
|
||||
"Liquid error: #{e.message}".freeze
|
||||
"Liquid error: #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ module Liquid
|
||||
|
||||
def read_template_file(template_path, context)
|
||||
full_path = full_path(template_path)
|
||||
raise FileSystemError, "No such template '#{template_path}'".freeze unless File.exists?(full_path)
|
||||
raise FileSystemError, "No such template '#{template_path}'" unless File.exists?(full_path)
|
||||
|
||||
File.read(full_path)
|
||||
end
|
||||
|
||||
def full_path(template_path)
|
||||
raise FileSystemError, "Illegal template name '#{template_path}'".freeze unless template_path =~ /^[^.\/][a-zA-Z0-9_\/]+$/
|
||||
raise FileSystemError, "Illegal template name '#{template_path}'" unless template_path =~ /^[^.\/][a-zA-Z0-9_\/]+$/
|
||||
|
||||
full_path = if template_path.include?('/'.freeze)
|
||||
File.join(root, File.dirname(template_path), @pattern % File.basename(template_path))
|
||||
@@ -65,7 +65,7 @@ module Liquid
|
||||
File.join(root, @pattern % template_path)
|
||||
end
|
||||
|
||||
raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'".freeze unless File.expand_path(full_path) =~ /^#{File.expand_path(root)}/
|
||||
raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'" unless File.expand_path(full_path) =~ /^#{File.expand_path(root)}/
|
||||
|
||||
full_path
|
||||
end
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
class Module
|
||||
|
||||
def liquid_methods(*allowed_methods)
|
||||
drop_class = eval "class #{self.to_s}::LiquidDropClass < Liquid::Drop; self; end".freeze
|
||||
drop_class = eval "class #{self.to_s}::LiquidDropClass < Liquid::Drop; self; end"
|
||||
define_method :to_liquid do
|
||||
drop_class.new(self)
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ module Liquid
|
||||
consume(:dotdot)
|
||||
last = expression
|
||||
consume(:close_round)
|
||||
"(#{first}..#{last})".freeze
|
||||
"(#{first}..#{last})"
|
||||
else
|
||||
raise SyntaxError, "#{token} is not a valid expression"
|
||||
end
|
||||
@@ -70,7 +70,7 @@ module Liquid
|
||||
end
|
||||
|
||||
str << expression
|
||||
str.freeze
|
||||
str
|
||||
end
|
||||
|
||||
def variable_signature
|
||||
|
||||
Reference in New Issue
Block a user