Journey::Visitors::Formatter

 

Used for formatting urls (url_for)

Attributes

options[R]
consumed[R]

Public Class Methods

new(options) click to toggle source
    # File lib/journey/visitors.rb, line 85
85:       def initialize options
86:         @options  = options
87:         @consumed = {}
88:       end

Private Instance Methods

binary(node) click to toggle source
     # File lib/journey/visitors.rb, line 104
104:       def binary node
105:         [visit(node.left), visit(node.right)].join
106:       end
nary(node) click to toggle source
     # File lib/journey/visitors.rb, line 108
108:       def nary node
109:         node.children.map { |c| visit c }.join
110:       end
terminal(node) click to toggle source
     # File lib/journey/visitors.rb, line 100
100:       def terminal node
101:         node.left
102:       end
visit_GROUP(node) click to toggle source
    # File lib/journey/visitors.rb, line 91
91:       def visit_GROUP node
92:         if consumed == options
93:           nil
94:         else
95:           route = visit node.left
96:           route.include?("\00"") ? nil : route
97:         end
98:       end
visit_SYMBOL(node) click to toggle source
     # File lib/journey/visitors.rb, line 112
112:       def visit_SYMBOL node
113:         key = node.to_sym
114: 
115:         if value = options[key]
116:           consumed[key] = value
117:           Router::Utils.escape_path(value)
118:         else
119:           "\00""
120:         end
121:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.