Sha256: 5c494d0f922974f68bb4806e43c542c1283549fd5dcdb7e8d8d645477ba143b2

Contents?: true

Size: 922 Bytes

Versions: 6

Compression:

Stored size: 922 Bytes

Contents

require 'erb'

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

        def initialize(pom: nil, plugins: nil)
          @pom = pom
          @plugins = plugins || []
          initialize_plugins
        end

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

        private

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/web_client/plugin_views_path.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/web_client/plugin_views_path.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/web_client/plugin_views_path.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/web_client/plugin_views_path.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/web_client/plugin_views_path.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/web_client/plugin_views_path.rb