Sha256: 86d90eefaafde64d2a5a17496d9077294e9a3444ac6b2d4602c52e38228d65f6

Contents?: true

Size: 842 Bytes

Versions: 7

Compression:

Stored size: 842 Bytes

Contents

module Lotus
  module Config
    # Assets configuration
    #
    # @since 0.1.0
    # @api private
    class Assets  < Utils::LoadPaths
      DEFAULT_DIRECTORY = 'public'.freeze

      # @since 0.1.0
      # @api private
      def initialize(root)
        @root = root
        @paths = Array(DEFAULT_DIRECTORY)
      end

      # @since 0.1.0
      # @api private
      def entries
        hash = Hash.new { |k, v| k[v] = [] }
        each do |path|
          if path.exist?
            hash[path.to_s] = path.children.map { |child| "/#{ child.basename }" }
          end
        end
        hash
      end

      # @since 0.2.0
      # @api private
      def any?
        @paths.any?
      end

      protected
      # @since 0.1.0
      # @api private
      def realpath(path)
        @root.join(path).realpath
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lotusrb-0.4.1 lib/lotus/config/assets.rb
lotusrb-0.4.0 lib/lotus/config/assets.rb
lotusrb-0.3.2 lib/lotus/config/assets.rb
lotusrb-0.3.1 lib/lotus/config/assets.rb
lotusrb-0.3.0 lib/lotus/config/assets.rb
lotusrb-0.2.1 lib/lotus/config/assets.rb
lotusrb-0.2.0 lib/lotus/config/assets.rb