lib/motion_bindable/bindable.rb in motion_bindable-0.2.4 vs lib/motion_bindable/bindable.rb in motion_bindable-0.2.5

- old
+ new

@@ -4,15 +4,10 @@ # # Bindable Module # # Allow attributes of an object to be bound to other arbitrary objects # through unique strategies. # - # ## One-way binding - # - # Currently bindings are only one-way, i.e change in the arbitrary object - # affects the bindable object but not vice-versa. - # module Bindable def bind_attributes(attrs, object = self) attrs.each_pair do |k, v| case v @@ -28,9 +23,10 @@ @bindings << strategy self end def unbind_all + @bindings ||= [] @bindings.each { |b| b.unbind } @bindings = [] end def strategy_for(reference)