Sha256: 358a41aca8fb0d5b0e665e56c8e640f6c5fae6916da617837b0078cbe8c9ecf3

Contents?: true

Size: 738 Bytes

Versions: 15

Compression:

Stored size: 738 Bytes

Contents

module ModsDisplay::ControllerExtension

  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

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

  private

  module ClassMethods
    def configure_mods_display &config
      @mods_display_config = ModsDisplay::Configuration.new &config
    end

    def mods_display_config
      @mods_display_config 
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mods_display-0.1.3 lib/mods_display/controller_extension.rb
mods_display-0.1.2 lib/mods_display/controller_extension.rb
mods_display-0.1.1 lib/mods_display/controller_extension.rb
mods_display-0.1.0 lib/mods_display/controller_extension.rb
mods_display-0.0.5 lib/mods_display/controller_extension.rb
mods_display-0.0.4 lib/mods_display/controller_extension.rb
mods_display-0.0.3 lib/mods_display/controller_extension.rb
mods_display-0.0.2 lib/mods_display/controller_extension.rb
mods_display-0.0.1 lib/mods_display/controller_extension.rb
mods_display-0.0.1.beta6 lib/mods_display/controller_extension.rb
mods_display-0.0.1.beta5 lib/mods_display/controller_extension.rb
mods_display-0.0.1.beta4 lib/mods_display/controller_extension.rb
mods_display-0.0.1.beta3 lib/mods_display/controller_extension.rb
mods_display-0.0.1.beta2 lib/mods_display/controller_extension.rb
mods_display-0.0.1.beta1 lib/mods_display/controller_extension.rb