Sha256: 1828be201bb21be9d2d4c698828d6bb2c714d84643b02166ae5c7d4a9966506e

Contents?: true

Size: 433 Bytes

Versions: 1

Compression:

Stored size: 433 Bytes

Contents

# encoding: utf-8

module PagesCore
  class PagePathConstraint
    def matches?(request)
      locale?(request.path_parameters[:locale]) &&
        exists?(
          request.path_parameters[:locale],
          request.path_parameters[:path]
        )
    end

    private

    def locale?(str)
      str.to_s =~ /\A[a-z]{2}\z/
    end

    def exists?(locale, path)
      PagePath.get(locale, path) ? true : false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_core-3.5.1 lib/pages_core/page_path_constraint.rb