Category: Ruby

  • Linked List to String

    The post discusses the implementation of a “stringify” method for a LinkedList class, allowing the conversion of node data into a string. Initial tests are conducted to ensure it functions for single and multiple data points, leading to code modifications for proper formatting and handling of empty lists.

  • Count a Linked List

    The content discusses developing a method to count nodes in a linked list. Initially, a simple test confirms the count function, resulting in identifying the need for additional robustness. The final implementation includes error handling for empty lists. Testing ensures functionality, with all tests passing at completion, validating the method’s effectiveness.

  • Linked List – Append

    The content details the development of an append method for a linked list using test-driven development (TDD). Initially, tests fail due to an undefined append method, prompting the creation of functionality to append data correctly. The implementation iterates through nodes to add multiple elements, ensuring they link appropriately without overwriting existing nodes.

  • Linked List Class

    The content outlines the initial steps to build a Linked List in Ruby, emphasizing the creation of the LinkedList class and basic tests. It details the importance of ensuring the class exists, initializing the head as nil, and implementing an empty? method to verify the list’s state. Subsequent additions are planned for functionality expansion.

  • Linked Lists

    In preparation for mod3, the author revisits an earlier linked list project, finding it less challenging after completing mod2. They focus on documentation and test-driven development using RSpec, outlining steps to create a Node class. The discussion includes initializing a Node and ensuring it can link to another node, setting the groundwork for building a…