Class: Dugway::Request
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- Dugway::Request
- Defined in:
- lib/dugway/request.rb
Instance Method Summary collapse
- #extension ⇒ Object
- #format ⇒ Object
- #html? ⇒ Boolean
- #js? ⇒ Boolean
- #page_permalink ⇒ Object
- #params ⇒ Object
Instance Method Details
#extension ⇒ Object
20 21 22 |
# File 'lib/dugway/request.rb', line 20 def extension File.extname(path).present? ? File.extname(path) : '.html' end |
#format ⇒ Object
24 25 26 |
# File 'lib/dugway/request.rb', line 24 def format params[:format] || extension[1..-1] end |
#html? ⇒ Boolean
28 29 30 |
# File 'lib/dugway/request.rb', line 28 def html? format == 'html' end |
#js? ⇒ Boolean
32 33 34 |
# File 'lib/dugway/request.rb', line 32 def js? format == 'js' end |
#page_permalink ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dugway/request.rb', line 7 def page_permalink case path when %r{^/$} 'home' when %r{^/(products|category|artist)/} 'products' when %r{^/product/} 'product' else File.basename(path[1..-1], '.*') end end |
#params ⇒ Object
3 4 5 |
# File 'lib/dugway/request.rb', line 3 def params super.update(env['rack.routing_args']).symbolize_keys end |