Module: ModsDisplay::ControllerExtension

Defined in:
lib/mods_display/controller_extension.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/mods_display/controller_extension.rb', line 3

def self.included(base)
  base.extend ClassMethods
  base.class_eval do
    def mods_display_config
      @mods_display_config || self.class.mods_display_config
    end
    if base.respond_to?(:helper_method)
      helper_method :mods_display_config, :render_mods_display
    end
  end
end

Instance Method Details

#render_mods_display(model) ⇒ Object



15
16
17
18
# File 'lib/mods_display/controller_extension.rb', line 15

def render_mods_display(model)
  return '' if model.mods_display_xml.nil?
  ModsDisplay::HTML.new(mods_display_config, model.mods_display_xml, self)
end