Sha256: cfcf4f60ad5c6b653a46b937ebafd68337ee48ad03ca0c606ce08140d1d6ca2d

Contents?: true

Size: 760 Bytes

Versions: 94

Compression:

Stored size: 760 Bytes

Contents

class DocumentationConstraint
  def self.documentation
    Nexmo::Markdown::CodeLanguage.route_constraint.merge(product_with_parent)
  end

  def self.products_for_routes
    product_with_parent_list
  end

  def self.product_with_parent
    { product: Regexp.new(product_with_parent_list.compact.reverse.join('|')) }
  end

  def self.product_with_parent_list
    raise ArgumentError, "The 'product' key in config/products.yml must be a list with at least one entry." if config.fetch('products', []).size.zero?

    @product_with_parent_list ||= config.fetch('products', []).map { |product| product['path'] }
  end

  def self.config
    @config ||= YAML.safe_load(
      File.read("#{Rails.configuration.docs_base_path}/config/products.yml")
    )
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
station-0.5.16 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.15 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.14 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.13 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.12 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.11 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.10 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.9 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.8 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.7 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.6 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.5 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.4 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.3 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.2 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.1 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.5.0 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.9 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.8 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.7 lib/nexmo_developer/app/constraints/documentation_constraint.rb