Merge pull request #551 from Shopify/expose-variable-name

Merge pull request 551
This commit is contained in:
Justin Li
2015-04-21 23:33:13 -04:00
2 changed files with 8 additions and 0 deletions
+2
View File
@@ -3,6 +3,8 @@ module Liquid
SQUARE_BRACKETED = /\A\[(.*)\]\z/m
COMMAND_METHODS = ['size'.freeze, 'first'.freeze, 'last'.freeze]
attr_reader :name, :lookups
def self.parse(markup)
new(markup)
end
+6
View File
@@ -147,4 +147,10 @@ class VariableUnitTest < Minitest::Test
var = Variable.new(%! name_of_variable | upcase !)
assert_equal " name_of_variable | upcase ", var.raw
end
def test_variable_lookup_interface
lookup = VariableLookup.new('a.b.c')
assert_equal 'a', lookup.name
assert_equal ['b', 'c'], lookup.lookups
end
end