module BinData::CopyOnChangePlugin
def copy_previous_value(obj)
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
def current_choice
def current_choice obj = super copy_previous_value(obj) obj end
def get_previous_choice(selection)
def get_previous_choice(selection) if selection != @last_selection and @last_selection != nil @choices[@last_selection] else nil end end
def remember_current_selection(selection)
def remember_current_selection(selection) @last_selection = selection end