Sha256: c71629f9e85dc9aa186563fe743ef61b8b4d792a418c345cf92d2e99815f0087

Contents?: true

Size: 912 Bytes

Versions: 4

Compression:

Stored size: 912 Bytes

Contents

module Plutonium
  module Core
    module Autodiscovery
      module RendererDiscoverer
        extend ActiveSupport::Concern
        include Discoverer

        class_methods do
          private

          def autodiscovery_renderer_cache = @autodiscovery_renderer_cache ||= {}
        end

        private

        # If cache_discovery is enabled, use the class level cache that persists
        # between requests, otherwise use the instance one.
        def autodiscovery_renderer_cache
          if Plutonium::Config.cache_discovery
            self.class.autodiscovery_renderer_cache
          else
            @autodiscovery_renderer_cache ||= {}
          end
        end

        def autodiscover_renderer(name)
          autodiscovery_renderer_cache[name] ||=
            Plutonium::Core::Fields::Renderers::Factory.for_resource_attribute(resource_class, name)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plutonium-0.6.2 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.6.1 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.6.0 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.5.0 lib/plutonium/core/autodiscovery/renderer_discoverer.rb