Sha256: a7dda08619f008c1131a2147d3645e9e30f33bb1a0c51c2daed04e7b6843eedf

Contents?: true

Size: 653 Bytes

Versions: 54

Compression:

Stored size: 653 Bytes

Contents

module Dugway
  class Request < Rack::Request
    def params
      super.update(env['rack.routing_args']).symbolize_keys
    end
    
    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
    
    def extension
      File.extname(path).present? ? File.extname(path) : '.html'
    end
    
    def format
      params[:format] || extension[1..-1]
    end
    
    def html?
      format == 'html'
    end

    def js?
      format == 'js'
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
dugway-1.0.14 lib/dugway/request.rb
dugway-1.0.13 lib/dugway/request.rb
dugway-1.0.12 lib/dugway/request.rb
dugway-1.0.10 lib/dugway/request.rb
dugway-1.0.9 lib/dugway/request.rb
dugway-1.0.8 lib/dugway/request.rb
dugway-1.0.7 lib/dugway/request.rb
dugway-1.0.6 lib/dugway/request.rb
dugway-1.0.5 lib/dugway/request.rb
dugway-1.0.4 lib/dugway/request.rb
dugway-1.0.3 lib/dugway/request.rb
dugway-1.0.2 lib/dugway/request.rb
dugway-1.0.1 lib/dugway/request.rb
dugway-1.0.0 lib/dugway/request.rb
dugway-0.12.3 lib/dugway/request.rb
dugway-0.12.2 lib/dugway/request.rb
dugway-0.12.1 lib/dugway/request.rb
dugway-0.12.0 lib/dugway/request.rb
dugway-0.11.4 lib/dugway/request.rb
dugway-0.11.3 lib/dugway/request.rb