Skip to content

Commit

Permalink
fix MatchData#[] on Ruby 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Mar 25, 2013
1 parent 88e81d8 commit 2098477
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Expand Up @@ -12,7 +12,7 @@ group :test, :development do
gem 'rspec', '>= 2.9.0' gem 'rspec', '>= 2.9.0'
end end


gem 'idn', :platform => :mri_18 #gem 'idn', :platform => :mri_18
gem 'idn-ruby', :platform => :mri_19 #gem 'idn-ruby', :platform => :mri_19


gemspec gemspec
6 changes: 3 additions & 3 deletions lib/addressable/template.rb
Expand Up @@ -150,7 +150,7 @@ def values
## ##
# Accesses captured values by name or by index. # Accesses captured values by name or by index.
# #
# @param [#to_int, #to_str, #to_sym] key # @param [String, Symbol, Fixnum] key
# Capture index or name. Note that when accessing by with index # Capture index or name. Note that when accessing by with index
# of 0, the full URI will be returned. The intention is to mimic # of 0, the full URI will be returned. The intention is to mimic
# the ::MatchData#[] behavior. # the ::MatchData#[] behavior.
Expand All @@ -169,7 +169,7 @@ def values
def [](key, len = nil) def [](key, len = nil)
if len if len
to_a[key, len] to_a[key, len]
elsif key.respond_to? :to_str or key.respond_to? :to_sym elsif String === key or Symbol === key
mapping[key.to_s] mapping[key.to_s]
else else
to_a[key] to_a[key]
Expand All @@ -194,7 +194,7 @@ def to_s


# Returns multiple captured values at once. # Returns multiple captured values at once.
# #
# @param [#to_int, #to_str, #to_sym] *indexes # @param [String, Symbol, Fixnum] *indexes
# Indices of the captures to be returned # Indices of the captures to be returned
# #
# @return [Array] # @return [Array]
Expand Down

0 comments on commit 2098477

Please sign in to comment.