Sha256: 7cc132923db3279a273057bf39c949270836cffbbfca3f4026d35b70005f4ee3

Contents?: true

Size: 531 Bytes

Versions: 3

Compression:

Stored size: 531 Bytes

Contents

class Storys::Storys
  attr_reader :root_path
  attr_reader :storys_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

3 entries across 3 versions & 1 rubygems

Version Path
storys-0.0.3 lib/storys/storys.rb
storys-0.0.2 lib/storys/storys.rb
storys-0.0.1 lib/storys/storys.rb