Sha256: c9db4cac0641d283c3f6a6e4b39a969bc6195f7b0b2cc13e14fd7a87c30df219

Contents?: true

Size: 674 Bytes

Versions: 5

Compression:

Stored size: 674 Bytes

Contents

require "mobile_enhancements"

module MobileEnhancements
  module RouteHelpers
    # all routes defined within the mobile_only block will require the mobile
    # prefix
    def mobile_only(&block)
      scope(mobile_path_prefix, mobile: mobile_path_prefix, &block)
    end
    
    # all routes defined within the mobile_optional block will be accessible
    # with and without the mobile prefix
    def mobile_optional(&block)
      scope("(:mobile)", {
        defaults: { mobile: nil },
        mobile: /(#{mobile_path_prefix})?/
      }, &block)
    end

    private
    def mobile_path_prefix
      MobileEnhancements.configuration.mobile_path_prefix
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mobile-enhancements-0.0.5 lib/mobile_enhancements/route_helpers.rb
mobile-enhancements-0.0.4 lib/mobile_enhancements/route_helpers.rb
mobile-enhancements-0.0.3 lib/mobile_enhancements/route_helpers.rb
mobile-enhancements-0.0.2 lib/mobile_enhancements/route_helpers.rb
mobile-enhancements-0.0.1 lib/mobile_enhancements/route_helpers.rb