Class: LandingPageConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/nexmo_developer/app/constraints/landing_page_constraint.rb

Class Method Summary collapse

Class Method Details

.landing_pages(root) ⇒ Object



11
12
13
14
15
16
17
# 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

.listObject



6
7
8
9
# 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?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/nexmo_developer/app/constraints/landing_page_constraint.rb', line 2

def self.matches?
  { landing_page: Regexp.new(list.join('|')) }
end