Class: Journey::Router::Utils

### Home Classes Methods

### In Files

- lib/journey/router/utils.rb

### Parent

Object

### Namespace

- MODULE Journey::Router::Utils::UriEscape

### Methods

- ::escape_fragment
- ::escape_path
- ::normalize_path
- ::unescape_uri

### Files

- CHANGELOG.rdoc
- Manifest.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Journey
- Journey::Formatter
- Journey::GTG
- Journey::GTG::Builder
- Journey::GTG::MatchData
- Journey::GTG::Simulator
- Journey::GTG::TransitionTable
- Journey::NFA
- Journey::NFA::Builder
- Journey::NFA::MatchData
- Journey::NFA::Simulator
- Journey::NFA::TransitionTable
- Journey::NFA::Visitor
- Journey::Nodes
- Journey::Nodes::Binary
- Journey::Nodes::Cat
- Journey::Nodes::Dummy
- Journey::Nodes::Group
- Journey::Nodes::Literal
- Journey::Nodes::Or
- Journey::Nodes::Star
- Journey::Nodes::Symbol
- Journey::Nodes::Terminal
- Journey::Nodes::Unary
- Journey::Parser
- Journey::Path
- Journey::Path::Pattern
- Journey::Path::Pattern::MatchData
- Journey::Route
- Journey::Router
- Journey::Router::RoutingError
- Journey::Router::Strexp
- Journey::Router::Utils
- Journey::Router::Utils::UriEscape
- Journey::Routes
- Journey::Scanner
- Rack

No matching classes.

# Journey::Router::Utils

### Constants

Parser

### Public Class Methods

escape_fragment(fragment) click to toggle source

    # File lib/journey/router/utils.rb, line 48
    def self.escape_fragment(fragment)
      Parser.escape(fragment.to_s, UriEscape::UNSAFE_FRAGMENT)
    end

escape_path(path) click to toggle source

    # File lib/journey/router/utils.rb, line 44
    def self.escape_path(path)
      Parser.escape(path.to_s, UriEscape::UNSAFE_SEGMENT)
    end

normalize_path(path) click to toggle source

Normalizes URI path.

Strips off trailing slash and ensures there is a leading slash.

    normalize_path("/foo")  # => "/foo"
    normalize_path("/foo/") # => "/foo"
    normalize_path("foo")   # => "/foo"
    normalize_path("")      # => "/"

    # File lib/journey/router/utils.rb, line 14
    def self.normalize_path(path)
      path = "/#{path}"
      path.squeeze!('/')
      path.sub!(%{/+\Z}, '')
      path = '/' if path == ''
      path
    end

unescape_uri(uri) click to toggle source

    # File lib/journey/router/utils.rb, line 52
    def self.unescape_uri(uri)
      Parser.unescape(uri)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.