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.1.5 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.4 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.3 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.2 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.1 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.1.0 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.145 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.144 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.143 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.142 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.141 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.140 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.139 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.138 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.137 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.136 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.135 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.134 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.133 lib/nexmo_developer/app/constraints/documentation_constraint.rb
station-0.0.132 lib/nexmo_developer/app/constraints/documentation_constraint.rb