From a1cffa6d5849b45f439be62742ccca1633dfc9bd Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Wed, 19 Dec 2012 17:52:50 -0500 Subject: remove code for Ruby 1.8.x support --- actionpack/lib/action_dispatch/journey/router/utils.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/action_dispatch/journey/router/utils.rb b/actionpack/lib/action_dispatch/journey/router/utils.rb index a21b570013..56df459bfb 100644 --- a/actionpack/lib/action_dispatch/journey/router/utils.rb +++ b/actionpack/lib/action_dispatch/journey/router/utils.rb @@ -31,13 +31,8 @@ module ActionDispatch safe_pchar = "#{URI::REGEXP::PATTERN::UNRESERVED}#{reserved_pchar}" safe_segment = "#{safe_pchar}#{reserved_segment}" safe_fragment = "#{safe_pchar}#{reserved_fragment}" - if RUBY_VERSION >= '1.9' - UNSAFE_SEGMENT = Regexp.new("[^#{safe_segment}]", false).freeze - UNSAFE_FRAGMENT = Regexp.new("[^#{safe_fragment}]", false).freeze - else - UNSAFE_SEGMENT = Regexp.new("[^#{safe_segment}]", false, 'N').freeze - UNSAFE_FRAGMENT = Regexp.new("[^#{safe_fragment}]", false, 'N').freeze - end + UNSAFE_SEGMENT = Regexp.new("[^#{safe_segment}]", false).freeze + UNSAFE_FRAGMENT = Regexp.new("[^#{safe_fragment}]", false).freeze end Parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI -- cgit v1.2.3 From a36ae63d0710814202401cf24dd9aa7a5ad9756a Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Wed, 19 Dec 2012 19:24:25 -0500 Subject: :nodoc: Journey because is not part of the public API [ci skip] --- .../lib/action_dispatch/journey/backwards.rb | 2 +- .../lib/action_dispatch/journey/formatter.rb | 11 +++++----- .../lib/action_dispatch/journey/gtg/builder.rb | 8 ++++---- .../lib/action_dispatch/journey/gtg/simulator.rb | 8 ++++---- .../journey/gtg/transition_table.rb | 6 +++--- .../lib/action_dispatch/journey/nfa/builder.rb | 8 ++++---- actionpack/lib/action_dispatch/journey/nfa/dot.rb | 6 +++--- .../lib/action_dispatch/journey/nfa/simulator.rb | 8 ++++---- .../journey/nfa/transition_table.rb | 6 +++--- .../lib/action_dispatch/journey/nodes/node.rb | 24 +++++++++++----------- actionpack/lib/action_dispatch/journey/parser.rb | 4 ++-- .../lib/action_dispatch/journey/parser_extras.rb | 4 ++-- .../lib/action_dispatch/journey/path/pattern.rb | 8 ++++---- actionpack/lib/action_dispatch/journey/route.rb | 4 ++-- actionpack/lib/action_dispatch/journey/router.rb | 7 ++++--- .../lib/action_dispatch/journey/router/strexp.rb | 6 +++--- .../lib/action_dispatch/journey/router/utils.rb | 8 ++++---- actionpack/lib/action_dispatch/journey/routes.rb | 9 ++++---- actionpack/lib/action_dispatch/journey/scanner.rb | 4 ++-- actionpack/lib/action_dispatch/journey/visitors.rb | 12 +++++------ 20 files changed, 75 insertions(+), 78 deletions(-) diff --git a/actionpack/lib/action_dispatch/journey/backwards.rb b/actionpack/lib/action_dispatch/journey/backwards.rb index 33f6976897..3bd20fdf81 100644 --- a/actionpack/lib/action_dispatch/journey/backwards.rb +++ b/actionpack/lib/action_dispatch/journey/backwards.rb @@ -1,4 +1,4 @@ -module Rack +module Rack # :nodoc: Mount = ActionDispatch::Journey::Router Mount::RouteSet = ActionDispatch::Journey::Router Mount::RegexpWithNamedGroups = ActionDispatch::Journey::Path::Pattern diff --git a/actionpack/lib/action_dispatch/journey/formatter.rb b/actionpack/lib/action_dispatch/journey/formatter.rb index 873a73baf0..106b9c33c3 100644 --- a/actionpack/lib/action_dispatch/journey/formatter.rb +++ b/actionpack/lib/action_dispatch/journey/formatter.rb @@ -1,9 +1,8 @@ module ActionDispatch module Journey - ### - # The Formatter class is used for formatting URLs. For example, parameters - # passed to +url_for+ in rails will eventually call Formatter#generate - class Formatter + # The Formatter class is used for formatting URLs. For example, parameters + # passed to +url_for+ in rails will eventually call Formatter#generate. + class Formatter # :nodoc: attr_reader :routes def initialize routes @@ -101,7 +100,7 @@ module ActionDispatch routes end - # returns an array populated with missing keys if any are present + # Returns an array populated with missing keys if any are present. def missing_keys route, parts missing_keys = [] tests = route.path.requirements @@ -123,7 +122,7 @@ module ActionDispatch }.flatten(1) end - # returns boolean, true if no missing keys are present + # Returns +true+ if no missing keys are present, otherwise +false+. def verify_required_parts! route, parts missing_keys(route, parts).empty? end diff --git a/actionpack/lib/action_dispatch/journey/gtg/builder.rb b/actionpack/lib/action_dispatch/journey/gtg/builder.rb index 10b53500fc..5f2e7b92ae 100644 --- a/actionpack/lib/action_dispatch/journey/gtg/builder.rb +++ b/actionpack/lib/action_dispatch/journey/gtg/builder.rb @@ -1,10 +1,10 @@ require 'action_dispatch/journey/gtg/transition_table' module ActionDispatch - module Journey - module GTG - class Builder - DUMMY = Nodes::Dummy.new # :nodoc: + module Journey # :nodoc: + module GTG # :nodoc: + class Builder # :nodoc: + DUMMY = Nodes::Dummy.new attr_reader :root, :ast, :endpoints diff --git a/actionpack/lib/action_dispatch/journey/gtg/simulator.rb b/actionpack/lib/action_dispatch/journey/gtg/simulator.rb index fda14c8680..802d692dd5 100644 --- a/actionpack/lib/action_dispatch/journey/gtg/simulator.rb +++ b/actionpack/lib/action_dispatch/journey/gtg/simulator.rb @@ -1,9 +1,9 @@ require 'strscan' module ActionDispatch - module Journey - module GTG - class MatchData + module Journey # :nodoc: + module GTG # :nodoc: + class MatchData # :nodoc: attr_reader :memos def initialize memos @@ -11,7 +11,7 @@ module ActionDispatch end end - class Simulator + class Simulator # :nodoc: attr_reader :tt def initialize transition_table diff --git a/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb b/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb index b6812b6475..2c34826bb0 100644 --- a/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb +++ b/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb @@ -1,9 +1,9 @@ require 'action_dispatch/journey/nfa/dot' module ActionDispatch - module Journey - module GTG - class TransitionTable + module Journey # :nodoc: + module GTG # :nodoc: + class TransitionTable # :nodoc: include Journey::NFA::Dot attr_reader :memos diff --git a/actionpack/lib/action_dispatch/journey/nfa/builder.rb b/actionpack/lib/action_dispatch/journey/nfa/builder.rb index 720820accb..8ba48e097d 100644 --- a/actionpack/lib/action_dispatch/journey/nfa/builder.rb +++ b/actionpack/lib/action_dispatch/journey/nfa/builder.rb @@ -2,9 +2,9 @@ require 'action_dispatch/journey/nfa/transition_table' require 'action_dispatch/journey/gtg/transition_table' module ActionDispatch - module Journey - module NFA - class Visitor < Visitors::Visitor + module Journey # :nodoc: + module NFA # :nodoc: + class Visitor < Visitors::Visitor # :nodoc: def initialize tt @tt = tt @i = -1 @@ -60,7 +60,7 @@ module ActionDispatch end end - class Builder + class Builder # :nodoc: def initialize ast @ast = ast end diff --git a/actionpack/lib/action_dispatch/journey/nfa/dot.rb b/actionpack/lib/action_dispatch/journey/nfa/dot.rb index 6d2f851c2c..5c33a872e5 100644 --- a/actionpack/lib/action_dispatch/journey/nfa/dot.rb +++ b/actionpack/lib/action_dispatch/journey/nfa/dot.rb @@ -1,9 +1,9 @@ # encoding: utf-8 module ActionDispatch - module Journey - module NFA - module Dot + module Journey # :nodoc: + module NFA # :nodoc: + module Dot # :nodoc: def to_dot edges = transitions.map { |from, sym, to| " #{from} -> #{to} [label=\"#{sym || 'ε'}\"];" diff --git a/actionpack/lib/action_dispatch/journey/nfa/simulator.rb b/actionpack/lib/action_dispatch/journey/nfa/simulator.rb index 9948213146..c2dfec3e21 100644 --- a/actionpack/lib/action_dispatch/journey/nfa/simulator.rb +++ b/actionpack/lib/action_dispatch/journey/nfa/simulator.rb @@ -1,9 +1,9 @@ require 'strscan' module ActionDispatch - module Journey - module NFA - class MatchData + module Journey # :nodoc: + module NFA # :nodoc: + class MatchData # :nodoc: attr_reader :memos def initialize memos @@ -11,7 +11,7 @@ module ActionDispatch end end - class Simulator + class Simulator # :nodoc: attr_reader :tt def initialize transition_table diff --git a/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb b/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb index 053ee4351a..c2bb513f01 100644 --- a/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb +++ b/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb @@ -1,9 +1,9 @@ require 'action_dispatch/journey/nfa/dot' module ActionDispatch - module Journey - module NFA - class TransitionTable + module Journey # :nodoc: + module NFA # :nodoc: + class TransitionTable # :nodoc: include Journey::NFA::Dot attr_accessor :accepting diff --git a/actionpack/lib/action_dispatch/journey/nodes/node.rb b/actionpack/lib/action_dispatch/journey/nodes/node.rb index 16d6cb8f0e..a372a37a90 100644 --- a/actionpack/lib/action_dispatch/journey/nodes/node.rb +++ b/actionpack/lib/action_dispatch/journey/nodes/node.rb @@ -1,8 +1,8 @@ require 'action_dispatch/journey/visitors' module ActionDispatch - module Journey - module Nodes + module Journey # :nodoc: + module Nodes # :nodoc: class Node # :nodoc: include Enumerable @@ -41,16 +41,16 @@ module ActionDispatch def literal?; false; end end - class Terminal < Node + class Terminal < Node # :nodoc: alias :symbol :left end - class Literal < Terminal + class Literal < Terminal # :nodoc: def literal?; true; end def type; :LITERAL; end end - class Dummy < Literal + class Dummy < Literal # :nodoc: def initialize x = Object.new super end @@ -66,7 +66,7 @@ module ActionDispatch eoruby end - class Symbol < Terminal + class Symbol < Terminal # :nodoc: attr_accessor :regexp alias :symbol :regexp @@ -83,19 +83,19 @@ module ActionDispatch def symbol?; true; end end - class Unary < Node + class Unary < Node # :nodoc: def children; [left] end end - class Group < Unary + class Group < Unary # :nodoc: def type; :GROUP; end end - class Star < Unary + class Star < Unary # :nodoc: def type; :STAR; end end - class Binary < Node + class Binary < Node # :nodoc: attr_accessor :right def initialize left, right @@ -106,11 +106,11 @@ module ActionDispatch def children; [left, right] end end - class Cat < Binary + class Cat < Binary # :nodoc: def type; :CAT; end end - class Or < Node + class Or < Node # :nodoc: attr_reader :children def initialize children diff --git a/actionpack/lib/action_dispatch/journey/parser.rb b/actionpack/lib/action_dispatch/journey/parser.rb index 2489cd61eb..bb4cbb00e2 100644 --- a/actionpack/lib/action_dispatch/journey/parser.rb +++ b/actionpack/lib/action_dispatch/journey/parser.rb @@ -9,8 +9,8 @@ require 'racc/parser.rb' require 'action_dispatch/journey/parser_extras' module ActionDispatch - module Journey - class Parser < Racc::Parser + module Journey # :nodoc: + class Parser < Racc::Parser # :nodoc: ##### State transition tables begin ### racc_action_table = [ diff --git a/actionpack/lib/action_dispatch/journey/parser_extras.rb b/actionpack/lib/action_dispatch/journey/parser_extras.rb index 43f9beda12..068e46bcbb 100644 --- a/actionpack/lib/action_dispatch/journey/parser_extras.rb +++ b/actionpack/lib/action_dispatch/journey/parser_extras.rb @@ -2,8 +2,8 @@ require 'action_dispatch/journey/scanner' require 'action_dispatch/journey/nodes/node' module ActionDispatch - module Journey - class Parser < Racc::Parser + module Journey # :nodoc: + class Parser < Racc::Parser # :nodoc: include Journey::Nodes def initialize diff --git a/actionpack/lib/action_dispatch/journey/path/pattern.rb b/actionpack/lib/action_dispatch/journey/path/pattern.rb index e14168aeb2..e5dc6e7432 100644 --- a/actionpack/lib/action_dispatch/journey/path/pattern.rb +++ b/actionpack/lib/action_dispatch/journey/path/pattern.rb @@ -1,7 +1,7 @@ module ActionDispatch - module Journey - module Path - class Pattern + module Journey # :nodoc: + module Path # :nodoc: + class Pattern # :nodoc: attr_reader :spec, :requirements, :anchored def initialize strexp @@ -133,7 +133,7 @@ module ActionDispatch end end - class MatchData + class MatchData # :nodoc: attr_reader :names def initialize names, offsets, match diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index 04d31cb580..2de711f091 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -1,6 +1,6 @@ module ActionDispatch - module Journey - class Route + module Journey # :nodoc: + class Route # :nodoc: attr_reader :app, :path, :verb, :defaults, :ip, :name attr_reader :constraints diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index 0f16510c95..59351f8e4d 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -12,11 +12,12 @@ require 'action_dispatch/journey/route' require 'action_dispatch/journey/path/pattern' module ActionDispatch - module Journey - class Router - class RoutingError < ::StandardError + module Journey # :nodoc: + class Router # :nodoc: + class RoutingError < ::StandardError # :nodoc: end + # :nodoc: VERSION = '2.0.0' class NullReq # :nodoc: diff --git a/actionpack/lib/action_dispatch/journey/router/strexp.rb b/actionpack/lib/action_dispatch/journey/router/strexp.rb index 268bb4602f..829ced8039 100644 --- a/actionpack/lib/action_dispatch/journey/router/strexp.rb +++ b/actionpack/lib/action_dispatch/journey/router/strexp.rb @@ -1,7 +1,7 @@ module ActionDispatch - module Journey - class Router - class Strexp + module Journey # :nodoc: + class Router # :nodoc: + class Strexp # :nodoc: class << self alias :compile :new end diff --git a/actionpack/lib/action_dispatch/journey/router/utils.rb b/actionpack/lib/action_dispatch/journey/router/utils.rb index 56df459bfb..462f1a122d 100644 --- a/actionpack/lib/action_dispatch/journey/router/utils.rb +++ b/actionpack/lib/action_dispatch/journey/router/utils.rb @@ -1,9 +1,9 @@ require 'uri' module ActionDispatch - module Journey - class Router - class Utils + module Journey # :nodoc: + class Router # :nodoc: + class Utils # :nodoc: # Normalizes URI path. # # Strips off trailing slash and ensures there is a leading slash. @@ -22,7 +22,7 @@ module ActionDispatch # URI path and fragment escaping # http://tools.ietf.org/html/rfc3986 - module UriEscape + module UriEscape # :nodoc: # Symbol captures can generate multiple path segments, so include /. reserved_segment = '/' reserved_fragment = '/?' diff --git a/actionpack/lib/action_dispatch/journey/routes.rb b/actionpack/lib/action_dispatch/journey/routes.rb index f9c4cdbd4b..c0966dd794 100644 --- a/actionpack/lib/action_dispatch/journey/routes.rb +++ b/actionpack/lib/action_dispatch/journey/routes.rb @@ -1,9 +1,8 @@ module ActionDispatch - module Journey - ### - # The Routing table. Contains all routes for a system. Routes can be - # added to the table by calling Routes#add_route - class Routes + module Journey # :nodoc: + # The Routing table. Contains all routes for a system. Routes can be + # added to the table by calling Routes#add_route. + class Routes # :nodoc: include Enumerable attr_reader :routes, :named_routes diff --git a/actionpack/lib/action_dispatch/journey/scanner.rb b/actionpack/lib/action_dispatch/journey/scanner.rb index b45d72668b..668dec0a35 100644 --- a/actionpack/lib/action_dispatch/journey/scanner.rb +++ b/actionpack/lib/action_dispatch/journey/scanner.rb @@ -1,8 +1,8 @@ require 'strscan' module ActionDispatch - module Journey - class Scanner + module Journey # :nodoc: + class Scanner # :nodoc: def initialize @ss = nil end diff --git a/actionpack/lib/action_dispatch/journey/visitors.rb b/actionpack/lib/action_dispatch/journey/visitors.rb index b3f4796607..8c055376ca 100644 --- a/actionpack/lib/action_dispatch/journey/visitors.rb +++ b/actionpack/lib/action_dispatch/journey/visitors.rb @@ -1,7 +1,7 @@ # encoding: utf-8 module ActionDispatch - module Journey - module Visitors + module Journey # :nodoc: + module Visitors # :nodoc: class Visitor # :nodoc: DISPATCH_CACHE = Hash.new { |h,k| h[k] = "visit_#{k}" @@ -39,7 +39,6 @@ module ActionDispatch end end - ## # Loop through the requirements AST class Each < Visitor # :nodoc: attr_reader :block @@ -54,7 +53,7 @@ module ActionDispatch end end - class String < Visitor + class String < Visitor # :nodoc: private def binary node @@ -74,9 +73,8 @@ module ActionDispatch end end - ### # Used for formatting urls (url_for) - class Formatter < Visitor + class Formatter < Visitor # :nodoc: attr_reader :options, :consumed def initialize options @@ -118,7 +116,7 @@ module ActionDispatch end end - class Dot < Visitor + class Dot < Visitor # :nodoc: def initialize @nodes = [] @edges = [] -- cgit v1.2.3