Method: Exlibris::Primo::Pnx::DedupMgr#method_missing

Defined in:
lib/exlibris/primo/pnx/dedup_mgr.rb

#method_missing(method, *args, &block) ⇒ Object

Dynamically set the duplicated control attributes.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/exlibris/primo/pnx/dedup_mgr.rb', line 54

def method_missing(method, *args, &block)
  if(duplicated_control_attributes.include? method)
    control_attribute = method.id2name.singularize
    self.class.send(:define_method, method) do
      variable_name = "@#{method}"
      if !instance_variable_defined?(variable_name)
        if dedupmgr?
          value = map_values_to_origins(control_attribute)
        elsif respond_to?(control_attribute)
          value = {recordid => send(control_attribute)}
        else
          value = {recordid => nil}
        end
        instance_variable_set(variable_name, value)
      end
      instance_variable_get(variable_name)
    end
    send method, *args, &block
  else
    super
  end
end