Class: Arrays::ArrayHelper
- Inherits:
-
Object
- Object
- Arrays::ArrayHelper
- Defined in:
- lib/liquid-arrays/array_helper.rb
Class Method Summary collapse
Class Method Details
.get_array(context, array_name, create) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/liquid-arrays/array_helper.rb', line 3 def self.get_array(context, array_name, create) unless array_name.nil? if context.key?(array_name) array = context[array_name] elsif create array = context.scopes.last[array_name] ||= [] end else if context.key?('block_array') array = context['block_array'] end end array.is_a?(Array) ? array : nil end |