Module: Exlibris::Primo::Pnx::DedupMgr
- Included in:
- Record
- Defined in:
- lib/exlibris/primo/pnx/dedup_mgr.rb
Overview
Handle PNX dedupmgr elements
Defined Under Namespace
Modules: ClassAttributes
Class Method Summary collapse
Instance Method Summary collapse
-
#dedupmgr? ⇒ Boolean
Is the record a dedupmrg record?.
-
#method_missing(method, *args, &block) ⇒ Object
Dynamically set the duplicated control attributes.
-
#respond_to?(method, include_private = false) ⇒ Boolean
Tell users we respond to pluralized PNX control elements.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#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 |
Class Method Details
.included(klass) ⇒ Object
9 10 11 12 13 |
# File 'lib/exlibris/primo/pnx/dedup_mgr.rb', line 9 def self.included(klass) klass.class_eval do extend ClassAttributes end end |
Instance Method Details
#dedupmgr? ⇒ Boolean
Is the record a dedupmrg record?
39 40 41 |
# File 'lib/exlibris/primo/pnx/dedup_mgr.rb', line 39 def dedupmgr? @dedupmgr ||= recordid.match /\Adedupmrg/ end |
#respond_to?(method, include_private = false) ⇒ Boolean
Tell users we respond to pluralized PNX control elements
80 81 82 |
# File 'lib/exlibris/primo/pnx/dedup_mgr.rb', line 80 def respond_to?(method, include_private=false) (duplicated_control_attributes.include? method) ? true : super end |