lib/glimmer/data_binding/model_binding.rb in glimmer-2.1.0 vs lib/glimmer/data_binding/model_binding.rb in glimmer-2.1.1
- old
+ new
@@ -73,10 +73,10 @@
# All nested property names
# e.g. property name expression "address.state" gives ['address', 'state']
# If there are any indexed property names, this returns indexes as properties.
# e.g. property name expression "addresses[1].state" gives ['addresses', '[1]', 'state']
def nested_property_names
- @nested_property_names ||= Concurrent::Array.new(property_name_expression.split(".").map {|pne| pne.match(/([^\[]+)(\[[^\]]+\])?/).to_a.drop(1)}.flatten.compact)
+ @nested_property_names ||= Concurrent::Array.new(property_name_expression.split(/\[|\./).map {|pne| pne.end_with?(']') ? "[#{pne}" : pne })
end
# Final nested property name
# e.g. property name expression "address.state" gives :state
def nested_property_name