Sha256: 8c32e25b97b68e4d2e6e904587780dd23d5db7ce885d0991c68d4f427bfec06d

Contents?: true

Size: 401 Bytes

Versions: 7

Compression:

Stored size: 401 Bytes

Contents

require 'pathname'

module Awestruct
  module Extensions
    module Relative

      def relative(href, p = page)
        begin
          Pathname.new(href).relative_path_from(Pathname.new(File.dirname(p.output_path))).to_s
        rescue Exception => e
          $LOG.error "#{e}" if $LOG.error?
          $LOG.error "#{e.backtrace.join("\n")}" if $LOG.error?
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
awestruct-0.5.3 lib/awestruct/extensions/relative.rb
awestruct-0.5.2.1 lib/awestruct/extensions/relative.rb
awestruct-0.5.2 lib/awestruct/extensions/relative.rb
awestruct-0.5.1 lib/awestruct/extensions/relative.rb
awestruct-0.5.1a lib/awestruct/extensions/relative.rb
awestruct-0.5.0 lib/awestruct/extensions/relative.rb
awestruct-0.5.0.cr lib/awestruct/extensions/relative.rb