Sha256: dc0a8a82b100bd7ae3bbbaa257502a3d5e1086b1a61181ee10065cf41f5ae260

Contents?: true

Size: 995 Bytes

Versions: 12

Compression:

Stored size: 995 Bytes

Contents

class Tutorial::Task
  attr_reader :name, :title, :description, :current_step

  def initialize(name:, title:, description:, current_step:)
    @name         = name
    @title        = title
    @description  = description
    @current_step = current_step
  end

  def active?
    @name == @current_step
  end

  def self.make_from(name:, code_language:, current_step:)
    file_loader = Tutorial::FileLoader.new(
      root: Tutorial.task_content_path,
      doc_name: name,
      code_language: code_language,
      format: 'md'
    )

    new(
      name: name,
      title: file_loader.yaml['title'],
      description: file_loader.yaml['description'],
      current_step: current_step
    )
  end

  def ==(other)
    name == other.name &&
      title == other.title &&
      description == other.description &&
      current_step == other.current_step
  end

  def eql?(other)
    self == other
  end

  def hash
    name.hash ^ title.hash ^ description.hash ^ current_step.hash
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
station-0.0.107 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.106 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.105 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.104 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.103 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.102 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.101 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.100 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.97 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.96 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.95 lib/nexmo_developer/app/models/tutorial/task.rb
station-0.0.93 lib/nexmo_developer/app/models/tutorial/task.rb