lib/glimmer/data_binding/model_binding.rb in glimmer-1.0.2 vs lib/glimmer/data_binding/model_binding.rb in glimmer-1.0.3
- old
+ new
@@ -1,18 +1,18 @@
# Copyright (c) 2007-2020 Andy Maleh
-#
+#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
-#
+#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
@@ -79,13 +79,13 @@
def convert_on_write(value)
apply_converter(@binding_options[:on_write], value)
end
def apply_converter(converter, value)
- return value if converter.nil?
- return value.send(converter) if (converter.is_a?(String) || converter.is_a?(Symbol)) && value.respond_to?(converter)
- return converter.call(value) if converter.respond_to?(:call, value)
+ return value if converter.nil?
+ return value.send(converter) if (converter.is_a?(String) || converter.is_a?(Symbol)) && value.respond_to?(converter)
+ return converter.call(value) if converter.respond_to?(:call, value)
raise Glimmer::Error, "Unsupported bind converter: #{converter.inspect}"
end
# All nested property names
# e.g. property name expression "address.state" gives ['address', 'state']
@@ -211,10 +211,10 @@
converted_value = value
invoke_property_writer(model, "#{property_name}=", converted_value) unless evaluate_property == converted_value
end
def evaluate_property
- value = nil
+ value = nil
value = invoke_property_reader(model, property_name) unless model.nil?
convert_on_read(value)
end
def evaluate_options_property