mirror of
https://github.com/kemko/liquid.git
synced 2026-01-06 02:05:41 +03:00
Merge pull request #1141 from ashmaroli/reduce-context-constructor-allocations
Reduce allocations from `Liquid::Context.new`
This commit is contained in:
@@ -21,8 +21,10 @@ module Liquid
|
||||
end
|
||||
|
||||
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false, resource_limits = nil, static_registers = {}, static_environments = {})
|
||||
@environments = [environments].flatten
|
||||
@static_environments = [static_environments].flatten.map(&:freeze).freeze
|
||||
@environments = [environments]
|
||||
@environments.flatten!
|
||||
|
||||
@static_environments = [static_environments].flat_map(&:freeze).freeze
|
||||
@scopes = [(outer_scope || {})]
|
||||
@registers = registers
|
||||
@static_registers = static_registers.freeze
|
||||
|
||||
Reference in New Issue
Block a user