Sha256: 6bb73eb745404b9ab3eadf70ab8fc1341efb45aa6eae1bc63d35bcfd13e26aed

Contents?: true

Size: 1014 Bytes

Versions: 94

Compression:

Stored size: 1014 Bytes

Contents

class TutorialList
  def self.by_product(product)
    {
      'tutorials' => tasks_for_product(product),

      'use_cases' => Nexmo::Markdown::UseCase.by_product(product).map do |t|
                       {
                         root: t.root,
                         path: t.document_path.to_s,
                         title: t.title,
                         product: product,
                         is_file?: true,
                         is_tutorial?: true,
                       }
                     end,
    }
  end

  def self.tasks_for_product(product)
    tasks = Hash.new { |h, k| h[k] = [] }
    all.each do |t|
      t.products.each do |p|
        t.product = p
        tasks[p].push(t)
      end
    end

    tasks[product]
  end

  def self.all
    tasks = []
    # TODO: make this work with I18n fallback
    Dir.glob("#{Rails.configuration.docs_base_path}/config/tutorials/#{I18n.default_locale}/*.yml") do |path|
      tasks.push(TutorialListItem.new(path))
    end
    tasks
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

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