Class: ActionDispatch::Journey::Path::Pattern::MatchData
- Inherits:
-
Object
- Object
- ActionDispatch::Journey::Path::Pattern::MatchData
- Defined in:
- lib/action_dispatch/journey/path/pattern.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Instance Method Summary collapse
- #[](x) ⇒ Object
- #captures ⇒ Object
-
#initialize(names, offsets, match) ⇒ MatchData
constructor
A new instance of MatchData.
- #length ⇒ Object
- #post_match ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(names, offsets, match) ⇒ MatchData
Returns a new instance of MatchData.
120 121 122 123 124 |
# File 'lib/action_dispatch/journey/path/pattern.rb', line 120 def initialize(names, offsets, match) @names = names @offsets = offsets @match = match end |
Instance Attribute Details
#names ⇒ Object (readonly)
Returns the value of attribute names.
118 119 120 |
# File 'lib/action_dispatch/journey/path/pattern.rb', line 118 def names @names end |
Instance Method Details
#[](x) ⇒ Object
130 131 132 133 |
# File 'lib/action_dispatch/journey/path/pattern.rb', line 130 def [](x) idx = @offsets[x - 1] + x @match[idx] end |
#captures ⇒ Object
126 127 128 |
# File 'lib/action_dispatch/journey/path/pattern.rb', line 126 def captures Array.new(length - 1) { |i| self[i + 1] } end |
#length ⇒ Object
135 136 137 |
# File 'lib/action_dispatch/journey/path/pattern.rb', line 135 def length @offsets.length end |
#post_match ⇒ Object
139 140 141 |
# File 'lib/action_dispatch/journey/path/pattern.rb', line 139 def post_match @match.post_match end |
#to_s ⇒ Object
143 144 145 |
# File 'lib/action_dispatch/journey/path/pattern.rb', line 143 def to_s @match.to_s end |