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.4.6 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.5 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.4 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.3 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.2 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.1 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.4.0 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.3.2 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.3.1 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.3.0 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.2.6 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.2.5 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.2.4 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.2.3 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.2.2 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.2.1 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.2.0 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.8 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.7 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.6 lib/nexmo_developer/app/constraints/documentation_constraint.rb