Sha256: e7450caa7d726a2d0668e7465cfebcb752f03d29dd7125f189ebf7fc8015dfe9

Contents?: true

Size: 531 Bytes

Versions: 8

Compression:

Stored size: 531 Bytes

Contents

class Mangos::Mangos
  attr_reader :root_path
  attr_reader :mangos_path

  def pathname_to_url(path, relative_from)
    URI.escape(path.relative_path_from(relative_from).to_s)
  end

  def url_to_pathname(url)
    path = Addressable::URI.unencode_component(url.normalized_path)
    path.gsub!(/^\//, "") #Make relative, if we allow mounting at a different root URL this will need to remove the root instead of just '/'
    root_url_path + path
  end

  def self.gem_path
    Pathname.new(__FILE__).dirname.parent.parent
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mangos-0.0.8 lib/mangos/mangos.rb
mangos-0.0.7 lib/mangos/mangos.rb
mangos-0.0.6 lib/mangos/mangos.rb
mangos-0.0.5 lib/mangos/mangos.rb
mangos-0.0.4 lib/mangos/mangos.rb
mangos-0.0.3 lib/mangos/mangos.rb
mangos-0.0.2 lib/mangos/mangos.rb
mangos-0.0.1 lib/mangos/mangos.rb