Sha256: 8ce7e4867ad5632d2c08467d14fcf5875a6c87978c397fc132cf2a50dadda560

Contents?: true

Size: 544 Bytes

Versions: 9

Compression:

Stored size: 544 Bytes

Contents

module StaticMatic
  module Helpers
    module CurrentPathHelper
      self.extend self
      
      def current_page
        @staticmatic.current_file
      end

      private

      def current_page_relative_path(current_path = nil)
        if current_path.nil? || current_path.match(/^((\.\.?)?\/|\#|.+?\:)/) == nil
          current_page_depth = current_page.split('/').length - 3;
          (current_page_depth > 0) ? ([ '..' ] * current_page_depth).join('/') + '/' : nil
        else
          nil
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
staticmatic2-2.1.8 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.7 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.6 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.5 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.4 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.3 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.2 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.1 lib/staticmatic/helpers/current_path_helper.rb
staticmatic2-2.1.0 lib/staticmatic/helpers/current_path_helper.rb