Sha256: e672c241cae5cdb8a18232dc16e59b5ab72fa2b8b5bef70ed5483dc315d9a926

Contents?: true

Size: 950 Bytes

Versions: 12

Compression:

Stored size: 950 Bytes

Contents

require 'erb'

module Coprl
  module Presenters
    module WebClient
      # This class renders headers for the plugins into the default layout.
      class PluginHeaders
        extend Pluggable
        include_plugins(:WebClientComponents)

        def initialize(pom:, render:)
          @pom = pom
          @render = render
          initialize_plugins
        end

        def render
          results = ""
          ((@plugins||[]) + Coprl::Presenters::Settings.config.presenters.plugins).each do |plugin|
            header_method = :"render_header_#{plugin}"
            results << send(header_method,
                 @pom,
                 render: @render) if respond_to?(header_method)
          end
          results
        end

        private

        def initialize_plugins
          @plugins = @pom.send(:plugins)
          self.class.include_plugins(:WebClientComponents, plugins: @plugins)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.6 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.5 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.4 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.3 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.2 lib/coprl/presenters/web_client/plugin_headers.rb
coprl-3.0.0.beta.1 lib/coprl/presenters/web_client/plugin_headers.rb