Skip to content

Commit

Permalink
Merge pull request #216 from enriclluelles/chore/improve-rails-compat…
Browse files Browse the repository at this point in the history
…ibility

Chore/improve rails compatibility
  • Loading branch information
tagliala committed Jun 20, 2020
2 parents 00d8ad8 + 02d4c3f commit fc1d8bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ jobs:
gemfile: gemfiles/rails_edge.gemfile
- rvm: 2.4.10
gemfile: gemfiles/rails_6.0.gemfile
- rvm: 2.7.1
gemfile: gemfiles/rails_5.0.gemfile
- rvm: 2.7.1
gemfile: gemfiles/rails_5.1.gemfile
- rvm: 2.7.1
gemfile: gemfiles/rails_5.2.gemfile
- rvm: ruby-head
gemfile: gemfiles/rails_5.0.gemfile
- rvm: ruby-head
gemfile: gemfiles/rails_5.1.gemfile
- rvm: ruby-head
gemfile: gemfiles/rails_5.2.gemfile
fast_finish: true
4 changes: 2 additions & 2 deletions lib/route_translator/translator/path/segment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ def translate_string(str, locale, scope)
def translate(segment, locale, scope)
return segment if segment.empty?

if segment.starts_with?(':')
if segment.start_with?(':')
named_param, hyphenized = segment.split('-', 2)
return "#{named_param}-#{translate(hyphenized, locale, scope)}" if hyphenized
end

return segment if segment.starts_with?('(', '*') || segment.include?(':')
return segment if segment.start_with?('(', '*') || segment.include?(':')

appended_part = segment.slice!(/(\()$/)
str = translatable_segment(segment)
Expand Down

0 comments on commit fc1d8bb

Please sign in to comment.