Sha256: ccdd56cd85395d6ab4a1f8ee58f45e4c2d696427ca8f11ae0fae47678f2fdc97

Contents?: true

Size: 787 Bytes

Versions: 20

Compression:

Stored size: 787 Bytes

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2020 Eric Crane.  All rights reserved.
#
# Here helper class,
# used to resolve relative referencing.
#

module Gloo
  module Core
    class Here

      HERE = '^'.freeze

      #
      # Does the pathname start with here reference?
      #
      def self.includes_here_ref?( elements )
        return elements.first.start_with?( HERE )
      end

      #
      # Expand here reference if present.
      #
      def self.expand_here( engine, pn )
        target = engine.exec_env.here_obj

        here = pn.elements.first
        remainder = pn.elements[ 1..-1 ].join( '.' )

        here.length.times { target = target.parent }
        pn.set_to "#{target.pn}.#{remainder}"
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
gloo-3.5.0 lib/gloo/core/here.rb
gloo-3.4.1 lib/gloo/core/here.rb
gloo-3.4.0 lib/gloo/core/here.rb
gloo-3.3.0 lib/gloo/core/here.rb
gloo-3.2.0 lib/gloo/core/here.rb
gloo-3.1.1 lib/gloo/core/here.rb
gloo-3.1.0 lib/gloo/core/here.rb
gloo-3.0.1 lib/gloo/core/here.rb
gloo-3.0.0 lib/gloo/core/here.rb
gloo-2.5.0 lib/gloo/core/here.rb
gloo-2.4.3 lib/gloo/core/here.rb
gloo-2.4.2 lib/gloo/core/here.rb
gloo-2.4.1 lib/gloo/core/here.rb
gloo-2.4.0 lib/gloo/core/here.rb
gloo-2.3.1 lib/gloo/core/here.rb
gloo-2.2.0 lib/gloo/core/here.rb
gloo-2.1.0 lib/gloo/core/here.rb
gloo-2.0.2 lib/gloo/core/here.rb
gloo-2.0.1 lib/gloo/core/here.rb
gloo-2.0.0 lib/gloo/core/here.rb