Sha256: ebc77321fc9275a60205f43bd3923f7c0b836fc347b97f2c95395da0dd12687f

Contents?: true

Size: 566 Bytes

Versions: 2

Compression:

Stored size: 566 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

2 entries across 2 versions & 1 rubygems

Version Path
staticmatic3-2.1.10 lib/staticmatic/helpers/current_path_helper.rb
staticmatic3-2.1.9 lib/staticmatic/helpers/current_path_helper.rb