Revert some freezes on non-literals

This commit is contained in:
Florian Weingarten
2014-01-27 14:56:07 -05:00
parent 43ac8d560b
commit 0a7de51e2b
6 changed files with 12 additions and 12 deletions

View File

@@ -92,7 +92,7 @@ module Liquid
end
def block_delimiter
"end#{block_name}".freeze
"end#{block_name}"
end
def block_name

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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