module BinData::CopyOnChangePlugin
Logic for the :copy_on_change parameter
Public Instance Methods
copy_previous_value(obj)
click to toggle source
# File lib/bindata/choice.rb, line 169 def copy_previous_value(obj) current_selection = selection prev = get_previous_choice(current_selection) obj.assign(prev) unless prev.nil? remember_current_selection(current_selection) end
current_choice()
click to toggle source
Calls superclass method
# File lib/bindata/choice.rb, line 163 def current_choice obj = super copy_previous_value(obj) obj end
get_previous_choice(selection)
click to toggle source
# File lib/bindata/choice.rb, line 176 def get_previous_choice(selection) if selection != @last_selection and @last_selection != nil @choices[@last_selection] else nil end end
remember_current_selection(selection)
click to toggle source
# File lib/bindata/choice.rb, line 184 def remember_current_selection(selection) @last_selection = selection end