lib/tilt/template.rb in tilt-2.0.5 vs lib/tilt/template.rb in tilt-2.0.6
- old
+ new
@@ -3,12 +3,10 @@
module Tilt
# @private
TOPOBJECT = Object.superclass || Object
# @private
LOCK = Mutex.new
- # @private
- SYMBOL_ARRAY_SORTABLE = RUBY_VERSION >= '1.9'
# Base class for template implementations. Subclasses must implement
# the #prepare method and one of the #evaluate or #precompiled_template
# methods.
class Template
@@ -156,15 +154,11 @@
#
# This method is only used by source generating templates. Subclasses that
# override render() may not support all features.
def evaluate(scope, locals, &block)
locals_keys = locals.keys
- if SYMBOL_ARRAY_SORTABLE
- locals_keys.sort!
- else
- locals_keys.sort!{|x, y| x.to_s <=> y.to_s}
- end
+ locals_keys.sort!{|x, y| x.to_s <=> y.to_s}
method = compiled_method(locals_keys)
method.bind(scope).call(locals, &block)
end
# Generates all template source by combining the preamble, template, and
@@ -250,10 +244,10 @@
method_name = "__tilt_#{Thread.current.object_id.abs}"
method_source = String.new
if method_source.respond_to?(:force_encoding)
- method_source.force_encoding(source.encoding)
+ method_source.force_encoding(source.encoding)
end
method_source << <<-RUBY
TOPOBJECT.class_eval do
def #{method_name}(locals)