Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/route_translator/extensions/mapper.rb
Defined Under Namespace
Modules: Base
Instance Method Summary collapse
Instance Method Details
#add_route(action, options) ⇒ Object
:nodoc:
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/route_translator/extensions/mapper.rb', line 13 def add_route(action, ) # :nodoc: path = path_for_action(action, .delete(:path)) if action.to_s =~ /^[\w\/]+$/ [:action] ||= action unless action.to_s.include?("/") else action = nil end if !.fetch(:as, true) .delete(:as) else [:as] = name_for_action([:as], action) end mapping = Mapping.new(@set, @scope, path, ) app, conditions, requirements, defaults, as, anchor = mapping.to_route if @localized @set.add_localized_route(app, conditions, requirements, defaults, as, anchor) else @set.add_route(app, conditions, requirements, defaults, as, anchor) end end |
#localized ⇒ Object
6 7 8 9 10 |
# File 'lib/route_translator/extensions/mapper.rb', line 6 def localized @localized = true yield @localized = false end |