Sha256: 5e3cb733da2277688e81ac31020ae8b8a19f3d684cd280c972d8365e901bb7e5

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

require 'eac_launcher/paths/real'

module EacLauncher
  module Paths
    class Logical
      include ::Eac::SimpleCache

      attr_reader :real, :logical, :parent_path

      def initialize(parent_path, real, logical)
        @parent_path = parent_path
        @real = ::EacLauncher::Paths::Real.new(real)
        @logical = logical
      end

      def to_s
        logical
      end

      def project?
        stereotypes.any?
      end

      def children
        r = []
        Dir.entries(warped).each do |c|
          c_path = ::File.join(warped, c)
          next unless ::File.directory?(c_path)
          next if c.start_with?('.')
          r << build_child(c)
        end
        r
      end

      private

      def stereotypes_uncached
        ::EacLauncher::Stereotype.stereotypes.select { |s| s.match?(self) }
      end

      def build_child(name)
        ::EacLauncher::Paths::Logical.new(
          self,
          ::File.join(warped, name),
          ::File.join(logical, name)
        )
      end

      def warped_uncached
        if is_a?(::EacLauncher::Instances::Base)
          stereotypes.each do |s|
            return s.warp_class.new(self) if s.warp_class
          end
        end
        real
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eac_launcher-0.3.2 lib/eac_launcher/paths/logical.rb
eac_launcher-0.3.1 lib/eac_launcher/paths/logical.rb
eac_launcher-0.3.0 lib/eac_launcher/paths/logical.rb
eac_launcher-0.2.2 lib/eac_launcher/paths/logical.rb
eac_launcher-0.2.1 lib/eac_launcher/paths/logical.rb