Module: Tap::Controller::Extname
- Defined in:
- lib/tap/controller/extname.rb
Overview
Add handling of extnames to controller paths. The extname of a request is chomped and stored in the extname attribute for use wherever.
Instance Method Summary collapse
-
#extname ⇒ Object
Returns the extname for the current request, or nil if no extname was specified in the paths_info.
-
#route ⇒ Object
Overrides route to chomp of the extname from the request path info.
Instance Method Details
#extname ⇒ Object
Returns the extname for the current request, or nil if no extname was specified in the paths_info.
10 11 12 |
# File 'lib/tap/controller/extname.rb', line 10 def extname @extname ||= nil end |
#route ⇒ Object
Overrides route to chomp of the extname from the request path info. If no extname is specified, extname will be remain nil.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/tap/controller/extname.rb', line 16 def route @extname = File.extname(request.path_info) @extname = nil if @extname.empty? args = super unless args.empty? || extname == nil args.last.chomp!(extname) end args end |