Method: PennMARC::Parser#method_missing
- Defined in:
- lib/pennmarc/parser.rb
#method_missing(name, record, *opts) ⇒ Object
Call helper class methods, passing along additional arguments as needed, e.g.: #title_show -> PennMARC::Title.show #subject_facet -> PennMARC::Subject.facet
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pennmarc/parser.rb', line 32 def method_missing(name, record, *opts) helper, method_name = parse_call(name) raise NoMethodError unless helper && method_name helper_klass = "PennMARC::#{helper.titleize}".constantize if opts.any? helper_klass.public_send(method_name, record, **opts.first) else helper_klass.public_send(method_name, record) end end |