lib/glimmer/data_binding/model_binding.rb in glimmer-0.5.3 vs lib/glimmer/data_binding/model_binding.rb in glimmer-0.5.4
- old
+ new
@@ -201,11 +201,14 @@
converted_value = value
invoke_property_writer(model, "#{property_name}=", converted_value) unless evaluate_property == converted_value
end
def evaluate_property
- invoke_property_reader(model, property_name) unless model.nil?
+ unless model.nil?
+ value = invoke_property_reader(model, property_name)
+ convert_on_read(value)
+ end
end
def evaluate_options_property
model.send(options_property_name) unless model.nil?
end
@@ -217,19 +220,17 @@
def property_indexed?(property_expression)
property_expression.to_s.start_with?('[')
end
def invoke_property_reader(object, property_expression)
- value = nil
if property_indexed?(property_expression)
property_method = '[]'
property_argument = property_expression[1...-1]
property_argument = property_argument.to_i if property_argument.match(/\d+/)
- value = object.send(property_method, property_argument)
+ object.send(property_method, property_argument)
else
- value = object.send(property_expression)
+ object.send(property_expression)
end
- convert_on_read(value)
end
def invoke_property_writer(object, property_expression, value)
value = convert_on_write(value)
if property_indexed?(property_expression)