mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 03:10:39 -07:00
Merge pull request #551 from Shopify/expose-variable-name
Merge pull request 551
This commit is contained in:
committed by
Florian Weingarten
parent
000d0c911b
commit
47dbcd93a5
@@ -3,6 +3,8 @@ module Liquid
|
|||||||
SQUARE_BRACKETED = /\A\[(.*)\]\z/m
|
SQUARE_BRACKETED = /\A\[(.*)\]\z/m
|
||||||
COMMAND_METHODS = ['size'.freeze, 'first'.freeze, 'last'.freeze]
|
COMMAND_METHODS = ['size'.freeze, 'first'.freeze, 'last'.freeze]
|
||||||
|
|
||||||
|
attr_reader :name, :lookups
|
||||||
|
|
||||||
def self.parse(markup)
|
def self.parse(markup)
|
||||||
new(markup)
|
new(markup)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -136,4 +136,10 @@ class VariableUnitTest < Minitest::Test
|
|||||||
var = Variable.new(%! name_of_variable | upcase !)
|
var = Variable.new(%! name_of_variable | upcase !)
|
||||||
assert_equal " name_of_variable | upcase ", var.raw
|
assert_equal " name_of_variable | upcase ", var.raw
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user