123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Journey::Path::Pattern::MatchData

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: actionpack/lib/action_dispatch/journey/path/pattern.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(names, offsets, match) ⇒ MatchData

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 127

def initialize(names, offsets, match)
  @names   = names
  @offsets = offsets
  @match   = match
end

Instance Attribute Details

#names (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 125

attr_reader :names

Instance Method Details

#[](x)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 141

def [](x)
  idx = @offsets[x - 1] + x
  @match[idx]
end

#captures

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 133

def captures
  Array.new(length - 1) { |i| self[i + 1] }
end

#length

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 146

def length
  @offsets.length
end

#named_captures

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 137

def named_captures
  @names.zip(captures).to_h
end

#post_match

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 150

def post_match
  @match.post_match
end

#to_s

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/path/pattern.rb', line 154

def to_s
  @match.to_s
end