botanicus/interfacer

View on GitHub
examples/2_class_override/external-lib/task_list.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

Task, Interfacer = import('external-lib/registry').grab(:Task, :Interfacer)

class TaskList
  extend Interfacer

  attribute(:task_class, :new) { Task }

  def tasks
    @tasks ||= Array.new
  end

  def <<(text)
    self.tasks << Task.new(text)
  end
end

export { TaskList }