Sha256: efb86098abb99ca9369ef21b1d9ca3d0751d3a48797d1d9c7dbfa802ff74ee46

Contents?: true

Size: 408 Bytes

Versions: 1

Compression:

Stored size: 408 Bytes

Contents

class Lalala::Pages::PageTypeConstraint

  def initialize(type)
    type = "#{type}_page"
    type = type.classify

    while type.ends_with?("PagePage")
      type = type[0..-5]
    end

    type = type.constantize
    @type = type
  end

  def matches?(request)
    return false if request.env["action_dispatch.exception"]
    request.env['lalala.page'] and @type === request.env['lalala.page']
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lalala-4.0.0.dev.191 lib/lalala/pages/page_type_constraint.rb