Sha256: 762cb63b221899ededdfd5b7c78b2d69eca6961f088664ea49d40061c126a9ea

Contents?: true

Size: 571 Bytes

Versions: 5

Compression:

Stored size: 571 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'pathname'

module Webgen

  # Namespace for classes and methods that provide common functionality.
  module Common

    autoload :Sitemap, 'webgen/common/sitemap'

    # Make the given +path+ absolute by prepending the absolute path +base+ if necessary. Also
    # resolves all '..'  and '.' references in +path+.
    def self.absolute_path(path, base)
      raise(ArgumentError, 'base has to be an absolute path') unless base =~ /\//
      Pathname.new(path =~ /^\// ? path : File.join(base, path)).cleanpath.to_s
    end

  end

end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
gettalong-webgen-0.5.7.20090227 lib/webgen/common.rb
gettalong-webgen-0.5.8.20090507 lib/webgen/common.rb
thewoolleyman-webgen-0.5.8.20090419 lib/webgen/common.rb
webgen-0.5.7 lib/webgen/common.rb
webgen-0.5.8 lib/webgen/common.rb