Sha256: 544f935001fd8936c46dc8ef1255cd2876528672429e10e88f0a04db0de490e2

Contents?: true

Size: 1.1 KB

Versions: 23

Compression:

Stored size: 1.1 KB

Contents

require 'hanami/utils/load_paths'

module Hanami
  module Assets
    # Configuration settings
    #
    # @since 0.1.0
    # @api private
    module Config
      # Global asset sources across all the duplicated <tt>Hanami::Assets</tt>
      # instances.
      #
      # @since 0.1.0
      # @api private
      #
      # @see Hanami::Assets.duplicate
      # @see http://www.rubydoc.info/gems/hanami-utils/Hanami/Utils/LoadPaths
      class GlobalSources < Utils::LoadPaths
        # @since 0.1.0
        # @api private
        def push(*paths)
          super

          sync_configuration
          sync_duplicated_frameworks
        end

        # @since 0.1.0
        # @api private
        alias << push

        private

        # @since 0.1.0
        # @api private
        def sync_configuration
          Hanami::Assets.configuration.sources << @paths
        end

        # @since 0.1.0
        # @api private
        def sync_duplicated_frameworks
          Hanami::Assets.duplicates.each do |duplicate|
            duplicate.configuration.sources << @paths
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
hanami-assets-1.3.4 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.3.3 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.3.2 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.3.1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.3.0 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.3.0.beta1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.2.0 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.2.0.rc2 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.2.0.rc1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.2.0.beta2 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.2.0.beta1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.1.1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.1.0 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.1.0.rc1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.1.0.beta3 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.1.0.beta2 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.1.0.beta1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.0.0 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.0.0.rc1 lib/hanami/assets/config/global_sources.rb
hanami-assets-1.0.0.beta2 lib/hanami/assets/config/global_sources.rb