abstract class TodoInputPort
- TodoInputPort
- Reference
- Object
Overview
Abstract class representing a Todo Input Port.
This abstract class defines a set of abstract methods for managing todos.
Example Usage:
# Create a concrete implementation of TodoInputPort
class TodoInputPortImpl < TodoInputPort
def get_all_todos : Array(Todo)
# implementation goes here
end
def get_todo_by_id(id : Int32) : Todo?
# implementation goes here
end
def create_todo(title : String) : Todo
# implementation goes here
end
def mark_todo_as_completed(todo : Todo) : Todo
# implementation goes here
end
end
Inputs: None
Flow:
- The abstract class 'TodoInputPort' defines four abstract methods:
get_all_todos
- This method returns an array of all todos.#get_todo_by_id
- This method takes an integer id as input and returns the corresponding todo object, or nil if not found.#create_todo
- This method takes a string title as input and creates a new todo object with the given title.#mark_todo_as_completed
- This method takes a todo object as input and marks it as completed.
Outputs:
- The
get_all_todos
method returns an array of todos. - The
#get_todo_by_id
method returns a todo object or nil. - The
#create_todo
method returns a newly created todo object. - The
#mark_todo_as_completed
method returns the updated todo object.
Direct Known Subclasses
Defined in:
domain/ports/todo_input.crInstance Method Summary
- #all_todos : Array(Todo)
- #create_todo(title : String) : Todo
- #get_todo_by_id(id : String) : Todo | Nil
- #mark_todo_as_completed(todo : Todo) : Todo