Sha256: 3b5232bb1d35fc84d1830599922cea562401c57f3f0fb0b32264b01608c875f8

Contents?: true

Size: 899 Bytes

Versions: 23

Compression:

Stored size: 899 Bytes

Contents

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

        class_methods do
          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.configuration.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

23 entries across 23 versions & 1 rubygems

Version Path
plutonium-0.15.18 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.17 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.16 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.15 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.14 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.13 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.12 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.11 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.10 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.9 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.8 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.7 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.6 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.5 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.4 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.3 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.2 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.1 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.0 lib/plutonium/core/autodiscovery/renderer_discoverer.rb
plutonium-0.15.0.pre.rc3 lib/plutonium/core/autodiscovery/renderer_discoverer.rb