class LandingPageConstraint

Public Class Methods

landing_pages(root) click to toggle source
# File lib/nexmo_developer/app/constraints/landing_page_constraint.rb, line 11
def self.landing_pages(root)
  Dir["#{root}/**/*.yml"].map do |filename|
    name = File.join(File.dirname(filename), File.basename(filename, '.yml')).gsub(root, '')
    name[0] = '' if name[0] == '/' # Remove leading slash for subdirectories
    name
  end
end
list() click to toggle source
# File lib/nexmo_developer/app/constraints/landing_page_constraint.rb, line 6
def self.list
  landing_pages("#{Rails.configuration.docs_base_path}/custom/landing_pages/") +
    landing_pages("#{Rails.configuration.docs_base_path}/config/landing_pages/")
end
matches?() click to toggle source
# File lib/nexmo_developer/app/constraints/landing_page_constraint.rb, line 2
def self.matches?
  { landing_page: Regexp.new(list.join('|')) }
end